Class: GtfsReader::Config::Sources

Inherits:
BasicObject
Defined in:
lib/gtfs_reader/config/sources.rb

Instance Method Summary collapse

Constructor Details

#initializeSources

Returns a new instance of Sources.



6
7
8
# File 'lib/gtfs_reader/config/sources.rb', line 6

def initialize
  @sources = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



18
19
20
21
22
# File 'lib/gtfs_reader/config/sources.rb', line 18

def method_missing(name, *args, &block)
  (@sources[name] ||= Source.new name).tap do |src|
    src.instance_exec src, &block if ::Kernel.block_given?
  end
end

Instance Method Details

#[](key) ⇒ Object



14
15
16
# File 'lib/gtfs_reader/config/sources.rb', line 14

def [](key)
  @sources[key]
end

#each(&block) ⇒ Object



10
11
12
# File 'lib/gtfs_reader/config/sources.rb', line 10

def each(&block)
  @sources.each &block
end