lib/config_mapper.rb in config_mapper-1.1.0 vs lib/config_mapper.rb in config_mapper-1.1.1
- old
+ new
@@ -1,7 +1,8 @@
-require "config_mapper/hash_target"
-require "config_mapper/object_target"
+require "config_mapper/config_dict"
+require "config_mapper/dict_mapper"
+require "config_mapper/object_mapper"
# Supports marshalling of plain-old data (e.g. loaded from
# YAML files) onto strongly-typed objects.
#
module ConfigMapper
@@ -19,19 +20,19 @@
# @param [Object, Hash] target the object to configure
#
# @return [Hash] exceptions encountered
#
def configure_with(data, target)
- target(target).with(data)
+ mapper_for(target).configure_with(data)
end
alias_method :set, :configure_with
- def target(target)
- if target.is_a?(Hash)
- HashTarget.new(target)
+ def mapper_for(target)
+ if target.is_a?(Hash) || target.is_a?(ConfigMapper::ConfigDict)
+ DictMapper.new(target)
else
- ObjectTarget.new(target)
+ ObjectMapper.new(target)
end
end
end