lib/mutils/serialization/results/attributes.rb in mutils-1.1.8 vs lib/mutils/serialization/results/attributes.rb in mutils-1.2.0
- old
+ new
@@ -7,10 +7,13 @@
module Results
# Module Attributes
module Attributes
def fetch_block_attributes(attributes, result_hash)
attributes&.each do |key, s_options|
- result_hash[key] = s_options[:block].call(scope, options[:params] || {})
+ arg = [scope]
+ arg << options[:params] || {} unless s_options[:block].parameters.flatten.include?(:rest)
+
+ result_hash[key] = s_options[:block].call(*arg)
end
end
def fetch_attributes(attributes, result_hash)
attributes&.each do |key, s_options|