Sha256: 9c83d46531ea191cf52da8ca57a0ccfac9f0d98b9f35b20b7622c22a884cd5e2

Contents?: true

Size: 307 Bytes

Versions: 1

Compression:

Stored size: 307 Bytes

Contents

require 'alba/association'

module Alba
  # Representing one association
  class One < Association
    def to_hash(target, params: {})
      object = target.public_send(@name)
      object = @condition.call(object, params) if @condition
      @resource.new(object, 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/one.rb