Skip to content

Instantly share code, notes, and snippets.

@irmiller22
Created October 15, 2013 14:15
Show Gist options
  • Select an option

  • Save irmiller22/6992231 to your computer and use it in GitHub Desktop.

Select an option

Save irmiller22/6992231 to your computer and use it in GitHub Desktop.
tap_method
class Dog
attr_accessor :name, :food, :breed
def bark
"Woof!"
end
def self.bark
"Awoo!"
end
end
roark = Dog.new
roark.name = "Roark"
roark.food = "Salmon"
roark.breed = "Springer Spaniel"
roark = Dog.new.tap {|dog| dog.name = "Roark"; dog.food = "Salmon"; dog.breed = "Springer Spaniel"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment