Sha256: 7428340600adecb8f15823c54bb4b6bc332fd28eb32630c5afe7ff3e55c5f965

Contents?: true

Size: 327 Bytes

Versions: 1

Compression:

Stored size: 327 Bytes

Contents

require 'alba/association'

module Alba
  # Representing many association
  class Many < Association
    def to_hash(target, params: {})
      objects = target.public_send(@name)
      objects = @condition.call(objects, params) if @condition
      objects.map { |o| @resource.new(o, params: params).to_hash }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alba-0.11.0 lib/alba/many.rb