Sha256: 520b50a5104aa54c00aaadbcd2a101c3b2b59c8c584bc851f61abf981097cc75

Contents?: true

Size: 748 Bytes

Versions: 20

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

# Module Mutils
module Mutils
  module Serialization
    # Module Results
    module Results
      # Module Relations
      module Relations
        def hash_relationships(relationships_array, result_hash)
          relationships = relationships_array&.compact
          relationships&.each do |key, s_options|
            object = scope.send(key)
            name = s_options[:label]
            Lib::Helper.instance.collection?(object) && (name = Lib::Helper.instance.pluralize(name))
            name = name.to_sym
            check_if_included(s_options, key) && (result_hash[name] = Lib::Helper.instance.constantize(s_options[:serializer]).new(object).to_h)
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mutils-1.3.3 lib/mutils/serialization/results/relations.rb
mutils-1.3.2 lib/mutils/serialization/results/relations.rb
mutils-1.3.1 lib/mutils/serialization/results/relations.rb
mutils-1.3.0 lib/mutils/serialization/results/relations.rb
mutils-1.2.6 lib/mutils/serialization/results/relations.rb
mutils-1.2.5 lib/mutils/serialization/results/relations.rb
mutils-1.2.2 lib/mutils/serialization/results/relations.rb
mutils-1.2.1 lib/mutils/serialization/results/relations.rb
mutils-1.2.0 lib/mutils/serialization/results/relations.rb
mutils-1.1.8 lib/mutils/serialization/results/relations.rb
mutils-1.1.7 lib/mutils/serialization/results/relations.rb
mutils-1.1.6 lib/mutils/serialization/results/relations.rb
mutils-1.1.5 lib/mutils/serialization/results/relations.rb
mutils-1.1.4 lib/mutils/serialization/results/relations.rb
mutils-1.1.3 lib/mutils/serialization/results/relations.rb
mutils-1.1.2 lib/mutils/serialization/results/relations.rb
mutils-1.1.1 lib/mutils/serialization/results/relations.rb
mutils-1.1.0 lib/mutils/serialization/results/relations.rb
mutils-1.0.1 lib/mutils/serialization/results/relations.rb
mutils-1.0.0 lib/mutils/serialization/results/relations.rb