Method: Targetmy::Config#parse
- Defined in:
- lib/targetmy/config.rb
#parse(config) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/targetmy/config.rb', line 16 def parse(config) config = config.is_a?(Hash) ? [config] : config config.each do |cnf| if SUPPORTED_ADV_TYPES.include? cnf[:type].to_sym type = cnf[:type].to_s.capitalize klass = Object.const_get("Targetmy::Config::#{type}") @items << klass.new(cnf) else raise Targetmy::UnsupportedKey.new(cnf[:type].to_sym) end end end |