Class: TypedParameter::Constraints::BooleanConstraint

Inherits:
Base
  • Object
show all
Defined in:
lib/typed_parameter/constraints/boolean_constraint.rb

Constant Summary collapse

TRUE_VALUES =
[true, 'true', '1', 1].freeze
FALSE_VALUES =
[false, 'false', '0', 0].freeze

Class Method Summary collapse

Class Method Details

.value(value) ⇒ Object



9
10
11
12
# File 'lib/typed_parameter/constraints/boolean_constraint.rb', line 9

def self.value(value)
  return true if TRUE_VALUES.include?(value)
  return false if FALSE_VALUES.include?(value)
end