Sha256: 75ae742bc351d2ec48aebb829840af3545784ad7b0c4fd19ac9da1c9dd92e33d

Contents?: true

Size: 323 Bytes

Versions: 2

Compression:

Stored size: 323 Bytes

Contents

class DefaultValue
  delegate :build, to: :builder
  attr_reader :klass, :method, :value

  def initialize(klass, method, value)
    @klass = klass
    @method = method
    @value = value
  end

  private

  def builder
    @builder ||= Sinclair.new(klass).tap do |b|
      b.add_method(method) { value }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinclair-1.1.1 spec/support/models/my_builder.rb
sinclair-1.1.0 spec/support/models/my_builder.rb