Sha256: 4b9ccaff076ef1cfb0b27a372b9f67cc3c30f5f8ea4ab442e0e2d45edb34aa61

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

# Module Mutils
module Mutils
  module Serialization
    # Module Results
    module Results
      # Module Attributes
      module Attributes
        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

        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutils-1.3.3 lib/mutils/serialization/results/attributes.rb
mutils-1.3.2 lib/mutils/serialization/results/attributes.rb
mutils-1.3.1 lib/mutils/serialization/results/attributes.rb