class Ruian::Fetcher

Public Instance Methods

county_file() click to toggle source
# File lib/ruian/fetcher.rb, line 59
def county_file
  @county_file = Ruian.root.join('fixtures', 'counties.csv')
end
county_integration_file() click to toggle source
# File lib/ruian/fetcher.rb, line 63
def county_integration_file
  @count_integration_file = Ruian.root.join('fixtures', 'vazby-okresy-cr.csv')
end
parse_counties(queue) { || ... } click to toggle source
# File lib/ruian/fetcher.rb, line 24
def parse_counties(queue, &block)
  Ruian::Parser.foreach(county_file, encoding: 'utf-8') do |attributes|
    attributes = attributes.collect(&:last)
    model = Ruian::Model::County.new(*attributes)
    queue.push(model)
  end
  yield
end
parse_counties_integration(queue) { || ... } click to toggle source
# File lib/ruian/fetcher.rb, line 33
def parse_counties_integration(queue, &block)
  Ruian::Parser.foreach(county_integration_file) do |attributes|
    attributes = attributes.collect(&:last)
    model = Ruian::Model::CountyIntegration.new(*attributes)
    queue.push(model)
  end
  yield
end
parse_regions(queue) { || ... } click to toggle source
# File lib/ruian/fetcher.rb, line 15
def parse_regions(queue, &block)
  Ruian::Parser.foreach(region_file, encoding: 'utf-8') do |attributes|
    attributes = attributes.collect(&:last)
    model = Ruian::Model::Region.new(*attributes)
    queue.push(model)
  end
  yield
end
parse_regions_integration(queue) { || ... } click to toggle source
# File lib/ruian/fetcher.rb, line 42
def parse_regions_integration(queue, &block)
  Ruian::Parser.foreach(region_integration_file) do |attributes|
    attributes = attributes.collect(&:last)
    model = Ruian::Model::RegionIntegration.new(*attributes)
    queue.push(model)
  end
  yield
end
parse_rows(queue) { || ... } click to toggle source
# File lib/ruian/fetcher.rb, line 4
def parse_rows(queue, &block)
  row_files.each do |file|
    Ruian::Parser.foreach(file) do |attributes|
      attributes = attributes.collect(&:last)
      model = Ruian::Model::Row.new(*attributes)
      queue.push(model)
    end
    yield
  end
end
region_file() click to toggle source
# File lib/ruian/fetcher.rb, line 55
def region_file
  @region_file = Ruian.root.join('fixtures', 'regions.csv')
end
region_integration_file() click to toggle source
# File lib/ruian/fetcher.rb, line 67
def region_integration_file
  @city_integration_file = Ruian.root.join('fixtures', 'vazby-cr.csv')
end
row_files() click to toggle source
# File lib/ruian/fetcher.rb, line 51
def row_files
  @files ||= Dir.glob(Ruian.root.join('fixtures/CSV', '*.csv'))
end