Module: GtfsReader

Extended by:
GtfsReader
Included in:
GtfsReader
Defined in:
lib/gtfs_reader/config/defaults/gtfs_feed_definition.rb,
lib/gtfs_reader.rb,
lib/gtfs_reader/log.rb,
lib/gtfs_reader/core.rb,
lib/gtfs_reader/version.rb,
lib/gtfs_reader/file_row.rb,
lib/gtfs_reader/exceptions.rb,
lib/gtfs_reader/file_reader.rb,
lib/gtfs_reader/feed_handler.rb,
lib/gtfs_reader/config/column.rb,
lib/gtfs_reader/config/source.rb,
lib/gtfs_reader/configuration.rb,
lib/gtfs_reader/config/sources.rb,
lib/gtfs_reader/source_updater.rb,
lib/gtfs_reader/bulk_feed_handler.rb,
lib/gtfs_reader/config/feed_definition.rb,
lib/gtfs_reader/config/file_definition.rb

Overview

This default config file creates a [FeedDefinition] that matches the one specified by Google. You can use this definition in most cases. A custom definition will only be required if you need to parse a feed that differs in some critical way (Remember that these feeds are not always created by technically-proficient people). See developers.google.com/transit/gtfs/reference

Defined Under Namespace

Modules: Config, Log, Version Classes: BulkDsl, BulkFeedHandler, BulkFeedHandlerDsl, Configuration, FeedHandler, FeedHandlerDsl, FileReader, FileReaderError, FileRow, HandlerMissingError, ParserContext, RequiredColumnsMissing, RequiredFilenamesMissing, SkipSourceError, SourceUpdater, UnknownSourceError

Constant Summary collapse

CSV_OPTIONS =
{ headers: :first_row,
return_headers: true,
header_converters: :symbol }

Instance Method Summary collapse

Instance Method Details

#config(*args, &blk) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/gtfs_reader/core.rb', line 18

def config(*args, &blk)
  @cfg ||= create_config
  if block_given?
    @cfg.instance_exec *args.unshift(@cfg), &blk
  elsif args.any?
    raise ArgumentError, 'arguments given without a block'
  end
  @cfg
end

#update(name) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/gtfs_reader/core.rb', line 32

def update(name)
  if config.verbose
    update_verbosely name
  else
    Log.quiet { update_verbosely name }
  end
end

#update_all!Object



28
29
30
# File 'lib/gtfs_reader/core.rb', line 28

def update_all!
  config.sources.each {|name, _| update name }
end