Class: EmberGen::Support::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ember-gen/support/config.rb

Constant Summary collapse

CONFIG_DIR =
File.join(File.dirname(__FILE__), 'configs')
VENDOR_MAP =
File.join(CONFIG_DIR, 'vendor_map.yml')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Config



11
12
13
14
15
16
17
18
# File 'lib/ember-gen/support/config.rb', line 11

def initialize(config)
  case config
  when :vendor_map
    @hash = load_yaml(VENDOR_MAP)
  else
    raise "Config mapping undefined for: #{config}"
  end
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



9
10
11
# File 'lib/ember-gen/support/config.rb', line 9

def hash
  @hash
end

Instance Method Details

#load_yaml(file) ⇒ Object



20
21
22
# File 'lib/ember-gen/support/config.rb', line 20

def load_yaml(file)
  YAML.load_file(file)
end