Sha256: 1213a48d61dfa3a2157d776e66370dcfd839e6f9a7aa2addda11eb5468d9dc0f

Contents?: true

Size: 299 Bytes

Versions: 2

Compression:

Stored size: 299 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) if @condition
      @resource.new(object, 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/one.rb
alba-0.10.0 lib/alba/one.rb