Module: TypedParameter::Constraints

Defined in:
lib/typed_parameter/constraints.rb,
lib/typed_parameter/constraints/base.rb,
lib/typed_parameter/constraints/date_constraint.rb,
lib/typed_parameter/constraints/float_constraint.rb,
lib/typed_parameter/constraints/string_constraint.rb,
lib/typed_parameter/constraints/boolean_constraint.rb,
lib/typed_parameter/constraints/integer_constraint.rb,
lib/typed_parameter/constraints/date_time_constraint.rb

Defined Under Namespace

Classes: Base, BooleanConstraint, DateConstraint, DateTimeConstraint, FloatConstraint, IntegerConstraint, StringConstraint

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object



17
18
19
# File 'lib/typed_parameter/constraints.rb', line 17

def [](name)
  @constraints[name].freeze
end

.register(key, constraint) ⇒ Object



12
13
14
15
# File 'lib/typed_parameter/constraints.rb', line 12

def register(key, constraint)
  @constraints ||= {}
  @constraints[key] = constraint
end