Class: Gdshowsdb::SongRefYAMLParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gdshowsdb/song_ref_yaml_parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(song_ref_list) ⇒ SongRefYAMLParser

Returns a new instance of SongRefYAMLParser.



7
8
9
# File 'lib/gdshowsdb/song_ref_yaml_parser.rb', line 7

def initialize(song_ref_list)
  @song_ref_list = song_ref_list
end

Class Method Details

.from_yamlObject



3
4
5
# File 'lib/gdshowsdb/song_ref_yaml_parser.rb', line 3

def self.from_yaml
  SongRefYAMLParser.new(Gdshowsdb.load_yaml('song_refs.yaml'))
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
# File 'lib/gdshowsdb/song_ref_yaml_parser.rb', line 11

def parse
  @song_ref_list.map do |song_ref|
    key = song_ref.keys.first
    value = song_ref[key]
    { uuid: value, name: key }
  end        
end