Skip to content

Instantly share code, notes, and snippets.

@codeschool-courses
Created October 13, 2012 20:40
Show Gist options
  • Save codeschool-courses/3886075 to your computer and use it in GitHub Desktop.
Save codeschool-courses/3886075 to your computer and use it in GitHub Desktop.
RubyBits II 6-6 - game.rb
class Game
attr_reader :name, :tags
def initialize(name)
@name = name
@tags = []
end
def year(value)
@year = value
end
def system(value)
@system = value
end
def print_details
puts "#{@name} - #{@year} (#{@system})"
end
def capture_screenshot
puts "Grabbing a screenshot for #{@name}"
end
def play
if @system == "SNES"
raise "No emulator for SNES games"
else
puts "Starting #{@name}"
end
end
def method_missing(method_name, *args)
@tags << method_name.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment