Sha256: 28a5424906a736ca4eaed0066050fde67160e6373abb702587b121bd2a138678

Contents?: true

Size: 771 Bytes

Versions: 6

Compression:

Stored size: 771 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

6 entries across 6 versions & 1 rubygems

Version Path
mutils-1.3.0 lib/mutils/serialization/results/attributes.rb
mutils-1.2.6 lib/mutils/serialization/results/attributes.rb
mutils-1.2.5 lib/mutils/serialization/results/attributes.rb
mutils-1.2.2 lib/mutils/serialization/results/attributes.rb
mutils-1.2.1 lib/mutils/serialization/results/attributes.rb
mutils-1.2.0 lib/mutils/serialization/results/attributes.rb