Class: Gdshowsdb::SetYAMLParser
- Inherits:
-
Object
- Object
- Gdshowsdb::SetYAMLParser
- Defined in:
- lib/gdshowsdb/set_yaml_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(show_list) ⇒ SetYAMLParser
constructor
A new instance of SetYAMLParser.
- #parse ⇒ Object
Constructor Details
#initialize(show_list) ⇒ SetYAMLParser
Returns a new instance of SetYAMLParser.
7 8 9 |
# File 'lib/gdshowsdb/set_yaml_parser.rb', line 7 def initialize(show_list) @show_list = show_list end |
Class Method Details
.from_yaml(year) ⇒ Object
3 4 5 |
# File 'lib/gdshowsdb/set_yaml_parser.rb', line 3 def self.from_yaml(year) SetYAMLParser.new(Gdshowsdb.load_yaml_for_year(year)) end |
Instance Method Details
#parse ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gdshowsdb/set_yaml_parser.rb', line 11 def parse parsed_sets = [] @show_list.each do |show_date, show| sets = show[:sets] if sets && !sets.empty? sets.each_with_index do |set, i| parsed_sets.push( {uuid: set[:uuid], show_uuid: show[:uuid], position: i, encore: ShowSet.encore?(sets, set)} ) end end end parsed_sets end |