Class: Gdshowsdb::ShowDBExtractor

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shows) ⇒ ShowDBExtractor



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

def initialize(shows)
  @shows = shows
end

Class Method Details

.from_db(year) ⇒ Object



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

def self.from_db(year)
  ShowDBExtractor.new(Show.where(year: year))
end

Instance Method Details

#extractObject



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

def extract
  @shows.map do |show|
    show.attributes.convert_to_sym.reject do |k,v| 
      k == :position and show.position == nil 
    end
  end      
end