Last active
December 12, 2015 05:48
-
-
Save koriroys/4724383 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NilClass | |
def to_s | |
nil | |
end | |
end | |
class Person | |
def initialize(options) | |
@first_name = options[:first_name] | |
@middle_name = options[:middle_name] | |
@last_name = options[:last_name] | |
end | |
def full_name | |
"#{@first_name} #{@middle_name} #{@last_name}" | |
end | |
end | |
person = Person.new(first_name: 'Kori', last_name: 'Roys') | |
puts person.full_name # => Kori #<NilClass:0x00000000000004> Roys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def initialize(options) | |
@first_name = options[:first_name] | |
@middle_name = options[:middle_name] | |
@last_name = options[:last_name] | |
end | |
def full_name | |
"#{@first_name} #{@middle_name} #{@last_name}" | |
end | |
end | |
person = Person.new(first_name: 'Kori', last_name: 'Roys') | |
puts person.full_name # => Kori Roys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment