Skip to content

Instantly share code, notes, and snippets.

@codeschool-courses
Created October 13, 2012 20:35
Show Gist options
  • Save codeschool-courses/3886064 to your computer and use it in GitHub Desktop.
Save codeschool-courses/3886064 to your computer and use it in GitHub Desktop.
RubyBits II 6-4 - library.rb
class Library
def initialize
@games = []
end
def add_game(game)
@games << game
end
def find_by_name(name)
@games.detect { |game| game.name == name }
end
def find_by_tag(tag)
@games.select { |game| game.tags.include?(tag) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment