Skip to content

Instantly share code, notes, and snippets.

@duonoid
Created March 1, 2012 22:09
Show Gist options
  • Save duonoid/1953593 to your computer and use it in GitHub Desktop.
Save duonoid/1953593 to your computer and use it in GitHub Desktop.
hello examples for Josh
$ 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