Sha256: 38b7e8db032fc24019055b0acde025ec6ba6f86b0592c5e1181fa512421dfe43

Contents?: true

Size: 354 Bytes

Versions: 13

Compression:

Stored size: 354 Bytes

Contents

# frozen_string_literal: true

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

13 entries across 13 versions & 1 rubygems

Version Path
sinclair-1.5.0 spec/support/models/default_value.rb
sinclair-1.4.2 spec/support/models/default_value.rb
sinclair-1.4.1 spec/support/models/default_value.rb
sinclair-1.4.0 spec/support/models/default_value.rb
sinclair-1.3.4 spec/support/models/default_value.rb
sinclair-1.3.3 spec/support/models/default_value.rb
sinclair-1.3.2 spec/support/models/default_value.rb
sinclair-1.3.1 spec/support/models/default_value.rb
sinclair-1.3.0 spec/support/models/default_value.rb
sinclair-1.2.1 spec/support/models/default_value.rb
sinclair-1.2.0 spec/support/models/default_value.rb
sinclair-1.1.3 spec/support/models/my_builder.rb
sinclair-1.1.2 spec/support/models/my_builder.rb