Created
February 25, 2013 03:55
-
-
Save djburdick/5027524 to your computer and use it in GitHub Desktop.
ruby module with self method. #ruby
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
module Party | |
def full_party? | |
self == 8? true : false | |
end | |
end | |
include Party | |
class People | |
attr_accessor :guests | |
end | |
people = People.new | |
people.guests = 8 | |
puts people.guests.full_party? | |
people.guests = 6 | |
puts people.guests.full_party? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment