Created
October 13, 2012 20:40
-
-
Save codeschool-courses/3886075 to your computer and use it in GitHub Desktop.
RubyBits II 6-6 - game.rb
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 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