Sha256: ab621652e626674e037fb3e710ef328b8c140ae7621853262383aa7b937ed308

Contents?: true

Size: 572 Bytes

Versions: 12

Compression:

Stored size: 572 Bytes

Contents

module Gdshowsdb
  class SongYAMLParser
    def self.from_yaml(year)
      SongYAMLParser.new(Gdshowsdb.load_yaml_for_year(year))
    end

    def initialize(shows)
      @shows = shows
    end

    def parse      
      parsed = []
      @shows.each do |key, value|
        sets = value[:sets]
        sets.each do |set|
          songs = set[:songs]
          songs.each_with_index do |song, i|
            parsed << song.merge({position: i, show_set_uuid: set[:uuid]})
          end if songs          
        end if sets       
      end
      parsed
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gdshowsdb-4.0.2 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-4.0.1 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-4.0.0 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-3.0.0 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-2.1.0 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-2.0.0 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-1.0.3 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-1.0.2 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-1.0.1 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-1.0.0 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-0.9.1 lib/gdshowsdb/song_yaml_parser.rb
gdshowsdb-0.9.0 lib/gdshowsdb/song_yaml_parser.rb