Last active
March 23, 2017 23:31
-
-
Save geocodinglife/7135f5e9a399137726c9817c3d196b43 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 Person | |
attr_reader :name | |
def initialize(name) | |
self.name = name | |
end | |
def name=(name) | |
if name == nil or name.size == 0 | |
raise ArgumentError.new('Must have a name.') | |
end | |
@name = name | |
end | |
end | |
p Person.new("Pedro") | |
# p Person.new(nil) | |
# p Person.new("") | |
# person = Person.new("Juan") | |
# p person.name = "Pedro" | |
# p person = nil | |
# p person1 = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment