module Mutils::Serialization::Results::Attributes

Module Attributes

Public Instance Methods

fetch_attributes(attributes, result_hash) click to toggle source
# File lib/mutils/serialization/results/attributes.rb, line 19
def fetch_attributes(attributes, result_hash)
  attributes&.each do |key, s_options|
    check_if_included(s_options, key) && (result_hash[key] = s_options[:method] ? send(key) : scope.send(key))
  end
end
fetch_block_attributes(attributes, result_hash) click to toggle source
# File lib/mutils/serialization/results/attributes.rb, line 10
def fetch_block_attributes(attributes, result_hash)
  attributes&.each do |key, s_options|
    arg = [scope]
    arg << options[:params] || {} unless s_options[:block].parameters.flatten.include?(:rest)

    result_hash[key] = s_options[:block].call(*arg)
  end
end