Class: Membrane::Schema::Bool

Inherits:
Base
  • Object
show all
Defined in:
lib/membrane/schema/bool.rb

Constant Summary collapse

TRUTH_VALUES =
Set.new([true, false])

Instance Method Summary collapse

Methods inherited from Base

#deparse

Instance Method Details

#validate(object) ⇒ Object



14
15
16
17
18
19
# File 'lib/membrane/schema/bool.rb', line 14

def validate(object)
  if !TRUTH_VALUES.include?(object)
    emsg = "Expected instance of true or false, given #{object}"
    raise Membrane::SchemaValidationError.new(emsg)
  end
end