Sha256: 0128fbfe55c938eb6c9b5ade6511dc3b5269e02e97adfa691814425978101990

Contents?: true

Size: 372 Bytes

Versions: 38

Compression:

Stored size: 372 Bytes

Contents

# frozen_string_literal: true

class DefaultValueBuilder < Sinclair
  def add_default_values(*methods)
    default_value = value

    methods.each do |method|
      add_method(method, cached: cache_type) { default_value }
    end

    build
  end

  private

  delegate :accept_nil, :value, to: :options_object

  def cache_type
    accept_nil ? :full : :simple
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
sinclair-1.6.7 spec/support/models/default_value_builder.rb
sinclair-1.6.6 spec/support/models/default_value_builder.rb
sinclair-1.6.5 spec/support/models/default_value_builder.rb
sinclair-1.6.4 spec/support/models/default_value_builder.rb
sinclair-1.6.3 spec/support/models/default_value_builder.rb
sinclair-1.6.2 spec/support/models/default_value_builder.rb
sinclair-1.6.1 spec/support/models/default_value_builder.rb
sinclair-1.6.0 spec/support/models/default_value_builder.rb
sinclair-1.5.2 spec/support/models/default_value_builder.rb
sinclair-1.5.1 spec/support/models/default_value_builder.rb
sinclair-1.5.0 spec/support/models/default_value_builder.rb
sinclair-1.4.2 spec/support/models/default_value_builder.rb
sinclair-1.4.1 spec/support/models/default_value_builder.rb
sinclair-1.4.0 spec/support/models/default_value_builder.rb
sinclair-1.3.4 spec/support/models/default_value_builder.rb
sinclair-1.3.3 spec/support/models/default_value_builder.rb
sinclair-1.3.2 spec/support/models/default_value_builder.rb
sinclair-1.3.1 spec/support/models/default_value_builder.rb