lib/hashematics/object_interface.rb in hashematics-1.0.0 vs lib/hashematics/object_interface.rb in hashematics-1.1.0

- old
+ new

@@ -12,24 +12,16 @@ # For example: configuration and objects passed into the module can be a little more liberal # in their specific types and key types. class ObjectInterface class << self def get(object, key) - if object.is_a?(Hash) - indifferent_hash_get(object, key) - elsif object.respond_to?(key) - object.send(key) - end + resolver.get(object, key) end private - def indifferent_hash_get(hash, key) - if hash.key?(key.to_s) - hash[key.to_s] - elsif hash.key?(key.to_s.to_sym) - hash[key.to_s.to_sym] - end + def resolver + @resolver ||= Objectable.resolver(separator: nil) end end end end