Module: Mutils::Serialization::Results::Attributes
- Included in:
- SerializationResults
- Defined in:
- lib/mutils/serialization/results/attributes.rb
Overview
Module Attributes
Instance Method Summary collapse
- #fetch_attributes(attributes, result_hash) ⇒ Object
- #fetch_block_attributes(attributes, result_hash) ⇒ Object
Instance Method Details
#fetch_attributes(attributes, result_hash) ⇒ Object
19 20 21 22 23 |
# File 'lib/mutils/serialization/results/attributes.rb', line 19 def fetch_attributes(attributes, result_hash) attributes&.each do |key, | check_if_included(, key) && (result_hash[key] = [:method] ? send(key) : scope.send(key)) end end |
#fetch_block_attributes(attributes, result_hash) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/mutils/serialization/results/attributes.rb', line 10 def fetch_block_attributes(attributes, result_hash) attributes&.each do |key, | arg = [scope] (arg << [:params]) || {} unless [:block].parameters.flatten.include?(:rest) result_hash[key] = [:block].call(*arg) end end |