Skip to content

Instantly share code, notes, and snippets.

@codeschool-courses
Created October 13, 2012 20:23
Show Gist options
  • Save codeschool-courses/3886018 to your computer and use it in GitHub Desktop.
Save codeschool-courses/3886018 to your computer and use it in GitHub Desktop.
RubyBits II 5-6 - game_dsl.rb
LIBRARY = Library.new
def add_game(name, &block)
game = Game.new(name)
game.instance_eval(&block)
LIBRARY.add_game(game)
end
def with_game(name, &block)
game = LIBRARY.find_by_name(name)
game.instance_eval(&block)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment