Class: Gdshowsdb::SetDBExtractor

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(show_sets) ⇒ SetDBExtractor

Returns a new instance of SetDBExtractor.



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

def initialize(show_sets)
  @show_sets = show_sets
end

Class Method Details

.from_db(year) ⇒ Object



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

def self.from_db(year)      
  SetDBExtractor.new(ShowSet.find_all_by_year(year))
end

Instance Method Details

#extractObject



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

def extract
  @show_sets.map do |show_set|
    hash = show_set.attributes.convert_to_sym
    hash[:show_uuid] = show_set.show.uuid
    hash
  end
end