lib/config_mapper.rb in config_mapper-1.2.0 vs lib/config_mapper.rb in config_mapper-1.3.0
- old
+ new
@@ -1,7 +1,7 @@
+require "config_mapper/collection_mapper"
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.
#
@@ -26,11 +26,11 @@
end
alias set configure_with
def mapper_for(target)
- if target.is_a?(Hash) || target.is_a?(ConfigMapper::ConfigDict)
- DictMapper.new(target)
+ if target.respond_to?(:[]) && target.respond_to?(:each)
+ CollectionMapper.new(target)
else
ObjectMapper.new(target)
end
end