lib/check_mot/resource.rb in check_mot-0.1.0 vs lib/check_mot/resource.rb in check_mot-0.3.1

- old
+ new

@@ -4,15 +4,14 @@ def initialize(source_hash) @source_hash = source_hash end def respond_to_missing?(name, include_private = false) - super || source_hash.keys.include?(name) + true end def method_missing(name, *args) - super unless source_hash.keys.include?(name) resolved_attribute(name) end def inspect # prevents extraneous output in the console: @@ -22,26 +21,26 @@ private attr_reader :source_hash def resolved_attribute(name) - resolved_attributes[name] ||= resolve_attribute(name, @source_hash[name]) + resolved_attributes[name] ||= resolve_attribute(name, source_hash[name]) end def resolved_attributes @_resolved_attributes ||= {} end def resolve_attribute(name, value) - attr = Attribute.resolve(name, value) + attribute = Attribute.resolve(name, value) - case attr + case attribute when Array - attr.map { |value| resolve_attribute(name, value) } + attribute.map { |value| resolve_attribute(name, value) } when Hash - Resource.new(attr) + Resource.new(attribute) when Attribute - attr.value + attribute.value else value end end end