Class: Structured::Integer

Inherits:
Object
  • Object
show all
Extended by:
Type
Defined in:
lib/structured/integer.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/integer.rb', line 5

def self.parse(yaml_value, stack:, context: nil)
  unless yaml_value.is_a?(::Integer)
    raise Structured::Errors::InvalidValue.new(
      stack,
      "#{stack} expects an integer, but found: #{yaml_value.inspect}"
    )
  end
  yaml_value
end