Class: BeerDb::Reader
- Inherits:
-
ReaderBase
- Object
- ReaderBase
- BeerDb::Reader
- Defined in:
- lib/beerdb/reader_file.rb
Overview
todo: “old” classic reader - rename to FileReader ?? why? why not?
Instance Method Summary collapse
- #create_beers_reader(name, more_attribs = {}) ⇒ Object
- #create_breweries_reader(name, more_attribs = {}) ⇒ Object
- #create_fixture_reader(name) ⇒ Object
-
#initialize(include_path, opts = {}) ⇒ Reader
constructor
A new instance of Reader.
Methods inherited from ReaderBase
#load, #load_beers_for_country, #load_beers_for_country_n_region, #load_beers_worker, #load_breweries_for_country, #load_breweries_for_country_n_region, #load_breweries_worker, #load_setup
Methods included from Matcher
#match_beers_for_country, #match_beers_for_country_n_region, #match_breweries_for_country, #match_breweries_for_country_n_region, #match_brewpubs_for_country, #match_brewpubs_for_country_n_region
Constructor Details
#initialize(include_path, opts = {}) ⇒ Reader
Returns a new instance of Reader.
9 10 11 |
# File 'lib/beerdb/reader_file.rb', line 9 def initialize( include_path, opts = {} ) @include_path = include_path end |
Instance Method Details
#create_beers_reader(name, more_attribs = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/beerdb/reader_file.rb', line 21 def create_beers_reader( name, more_attribs={} ) real_name = name_to_real_name( name ) path = "#{@include_path}/#{real_name}.txt" logger.info "parsing data (beers) '#{name}' (#{path})..." ValuesReader.from_file( path, more_attribs ) ## ValuesReaderV2.new( name, @include_path, more_attribs ) end |
#create_breweries_reader(name, more_attribs = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/beerdb/reader_file.rb', line 32 def create_breweries_reader( name, more_attribs={} ) real_name = name_to_real_name( name ) path = "#{@include_path}/#{real_name}.txt" logger.info "parsing data (breweries) '#{name}' (#{path})..." ValuesReader.from_file( path, more_attribs ) ## ValuesReaderV2.new( name, @include_path, more_attribs ) end |
#create_fixture_reader(name) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/beerdb/reader_file.rb', line 13 def create_fixture_reader( name ) path = "#{@include_path}/#{name}.txt" logger.info "parsing data (setup) '#{name}' (#{path})..." FixtureReader.from_file( path ) end |