lib/prontoforms/resource.rb in prontoforms-1.0.1 vs lib/prontoforms/resource.rb in prontoforms-2.0.0
- old
+ new
@@ -18,10 +18,11 @@
def self.property(name, key: nil, &block)
define_method(name) do
if block_given?
instance_eval(&block)
elsif !key.nil?
- data.fetch(key)
+ key = [key] unless key.is_a?(Array)
+ key.inject(data) { |obj, k| obj.fetch(k) }
end
end
end
def initialize(data, client, parent = nil)