Created
October 15, 2013 14:15
-
-
Save irmiller22/6992231 to your computer and use it in GitHub Desktop.
tap_method
This file contains hidden or 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 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