Skip to content

Instantly share code, notes, and snippets.

@chalmagean
Created December 21, 2020 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chalmagean/ecacf844ab70c9b9b855c6cb93ba4b59 to your computer and use it in GitHub Desktop.
Save chalmagean/ecacf844ab70c9b9b855c6cb93ba4b59 to your computer and use it in GitHub Desktop.
class Printer
def self.full_name(person)
"Your name is: #{person.fname} #{person.lname}"
end
end
class Person
attr_reader :fname, :lname
def initialize(fname, lname)
@fname = fname
@lname = lname
raise "Firstname too short" if fname.empty?
end
end
john = Person.new("", "Doe")
puts Printer.full_name(john)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment