Method: Targetmy::Config::Site#parse

Defined in:
lib/targetmy/config/site.rb

#parse(config) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/targetmy/config/site.rb', line 14

def parse(config)
  config_required_items = REQUIRED_KEYS & config.keys
  raise Targetmy::MissingRequiredKeys if config_required_items.length != REQUIRED_KEYS.length

  SUPPORTED_KEYS.each do |key|
    next unless config.has_key?(key)
    
    case key
    when :adv_products
      @adv_products = []
      parse_adv_products config[key]
    else
      instance_variable_set("@#{key}", config[key])
    end
  end
end