Sha256: 09b6909ce246b90fc5dab98ffde9d30b2d98a536d629c48cc4c3dc4e3a19a544
Contents?: true
Size: 662 Bytes
Versions: 4
Compression:
Stored size: 662 Bytes
Contents
require 'yaml' module Kosher class Venue < Structure DATA_PATH = File.expand_path("../../../data/venues.yml", __FILE__) key :_id, Integer key :country, String key :name, String class << self include Enumerable def all @all ||= YAML.load_file(DATA_PATH).map do |hsh| hsh['_id'] ||= hsh.delete('id') new(hsh) end end def amazon @amazons ||= find_all { |e| e.name.include? 'Amazon' } end def each(&block) all.each { |item| block.call(item) } end def find(id) super() { |item| item._id == id } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
kosher-0.14.2 | lib/kosher/venue.rb |
kosher-0.14.1 | lib/kosher/venue.rb |
kosher-0.14.0 | lib/kosher/venue.rb |
kosher-0.13.0 | lib/kosher/venue.rb |