Skip to content

Instantly share code, notes, and snippets.

@chalmagean
Created December 21, 2020 10:55
Show Gist options
  • Select an option

  • Save chalmagean/ecacf844ab70c9b9b855c6cb93ba4b59 to your computer and use it in GitHub Desktop.

Select an option

Save chalmagean/ecacf844ab70c9b9b855c6cb93ba4b59 to your computer and use it in GitHub Desktop.

Revisions

  1. chalmagean created this gist Dec 21, 2020.
    18 changes: 18 additions & 0 deletions typedd.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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)