Sha256: 47168d4b98668dc59a48728fb09adfc5106b1ac510c8474206eefeca6193eb41

Contents?: true

Size: 319 Bytes

Versions: 2

Compression:

Stored size: 319 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) if @condition
      objects.map { |o| @resource.new(o, params: params).to_hash }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alba-0.10.2 lib/alba/many.rb
alba-0.10.0 lib/alba/many.rb