Module: ParamsReady::Parameter::ValueParameterBuilder::ValueLike

Included in:
ParamsReady::Parameter::ValueParameterBuilder
Defined in:
lib/params_ready/parameter/value_parameter.rb

Instance Method Summary collapse

Instance Method Details

#coerce(&block) ⇒ Object



50
51
52
# File 'lib/params_ready/parameter/value_parameter.rb', line 50

def coerce(&block)
  @definition.set_coerce(block)
end

#constrain(name_or_constraint, *args, strategy: :raise, **opts, &block) ⇒ Object



45
46
47
48
# File 'lib/params_ready/parameter/value_parameter.rb', line 45

def constrain(name_or_constraint, *args, strategy: :raise, **opts, &block)
  validator = Value::Validator.instance(name_or_constraint, *args, strategy: strategy, **opts, &block)
  @definition.add_constraint validator
end

#format(&block) ⇒ Object



54
55
56
# File 'lib/params_ready/parameter/value_parameter.rb', line 54

def format(&block)
  @definition.set_format(block)
end

#type_identifier(name) ⇒ Object



58
59
60
# File 'lib/params_ready/parameter/value_parameter.rb', line 58

def type_identifier(name)
  @definition.set_type_identifier(name)
end