Created
March 1, 2012 22:09
-
-
Save duonoid/1953593 to your computer and use it in GitHub Desktop.
hello examples for Josh
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
$ cat bitizen.rb | |
module BitTypes | |
def bit_types | |
%w[ Food Service Recreation Retail Creative ] | |
end | |
end | |
class Job | |
include BitTypes | |
end | |
class Bitizen | |
include BitTypes | |
attr_accessor :name | |
attr_accessor :skills | |
def initialize | |
self.skills = {} | |
bit_types.each do |skill| | |
self.skills[skill] = 'noob' | |
end | |
end | |
end | |
b = Bitizen.new | |
b.name = "Ruby Guy" | |
b.skills[:ruby] = true | |
puts "name: #{b.name} -- skills: #{b.skills.inspect}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment