Skip to content

Instantly share code, notes, and snippets.

@Oceantidote
Created May 2, 2020 16:44
Show Gist options
  • Save Oceantidote/6aac330292848b7b83576d8b2036126e to your computer and use it in GitHub Desktop.
Save Oceantidote/6aac330292848b7b83576d8b2036126e to your computer and use it in GitHub Desktop.
class BareCitizen
# def initialize(name)
# @name = name
# end
def declare
puts "I AM #{@name}"
end
def name(name)
puts "I AM #{name}"
end
end
# better_citizen = BareCitizen.new("bob")
# other_citizen = BareCitizen.new("phil")
new_citizen = w
new_citizen.name("peter")
require "pry-byebug"
1.times do
binding.pry
end
class Citizen
attr_accessor :age
def initialize(first_name, last_name, age)
@first_name = first_name
@last_name = last_name
@age = age
end
def can_vote?
@age >= 18
end
def full_name
f = @first_name.strip.capitalize
l = @last_name.strip.capitalize
"#{f} #{l}"
end
end
bob = Citizen.new("bob", "hope", 15)
bob.age = 40
bob.age
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment