Class: Structured::Boolean

Inherits:
Object
  • Object
show all
Extended by:
Type
Defined in:
lib/structured/boolean.rb

Class Method Summary collapse

Methods included from Type

default_value, parse, type_name

Class Method Details

.parse(yaml_value, stack:, context: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/structured/boolean.rb', line 5

def self.parse(yaml_value, stack:, context: nil)
  unless yaml_value == true || yaml_value == false
    raise Structured::Errors::InvalidValue.new(
      stack,
      "#{stack} expects a boolean, but found: #{yaml_value.inspect}"
    )
  end
  yaml_value
end