Class: Flight::Router::Map

Inherits:
MapBase
  • Object
show all
Defined in:
lib/flight/router/map.rb

Defined Under Namespace

Modules: Builder

Instance Method Summary collapse

Methods inherited from MapBase

#config, #group, #map, #set

Constructor Details

#initialize(env:, input_dir:) ⇒ Map

Returns a new instance of Map.



27
28
29
30
31
# File 'lib/flight/router/map.rb', line 27

def initialize(env:,input_dir:)
  @env = env
  @input_dir = input_dir
  @builder = Builder.builder
end

Instance Method Details

#env(**opts) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/flight/router/map.rb', line 33

def env(**opts)
  if opts.empty?
    @env
  else
    unless opts.has_key?(@env)
      raise "env not defined: [#{@env}]"
    end
    opts[@env]
  end
end

#load_yaml(file) ⇒ Object



44
45
46
# File 'lib/flight/router/map.rb', line 44

def load_yaml(file)
  YAML.load_file File.join(@input_dir,file)
end