Class: GtfsReader::Config::FeedDefinition
- Inherits:
-
Object
- Object
- GtfsReader::Config::FeedDefinition
- Defined in:
- lib/gtfs_reader/config/feed_definition.rb
Overview
Describes a GTFS feed and the files it is expected to provide.
Instance Method Summary collapse
- #file(name, *args, &block) ⇒ Object
-
#files ⇒ Array<FileDefinition>
All of the defined files.
-
#initialize ⇒ FeedDefinition
constructor
A new instance of FeedDefinition.
- #optional_files ⇒ Object
- #required_files ⇒ Object
Constructor Details
#initialize ⇒ FeedDefinition
Returns a new instance of FeedDefinition.
8 9 10 |
# File 'lib/gtfs_reader/config/feed_definition.rb', line 8 def initialize @file_definition = {} end |
Instance Method Details
#file(name, *args, &block) ⇒ FileDefinition #file(name) ⇒ FileDefinition
40 41 42 43 44 45 46 |
# File 'lib/gtfs_reader/config/feed_definition.rb', line 40 def file(name, *args, &block) return @file_definition[name] unless block_given? definition_for!( name, args.first ).tap do |d| d.instance_exec &block if block end end |
#files ⇒ Array<FileDefinition>
Returns All of the defined files.
13 14 15 |
# File 'lib/gtfs_reader/config/feed_definition.rb', line 13 def files @file_definition.values end |
#optional_files ⇒ Object
21 22 23 |
# File 'lib/gtfs_reader/config/feed_definition.rb', line 21 def optional_files files.reject &:required? end |
#required_files ⇒ Object
17 18 19 |
# File 'lib/gtfs_reader/config/feed_definition.rb', line 17 def required_files files.select &:required? end |