Class: Leftovers::ConfigLoader::ScalarValueSchema

Inherits:
Schema
  • Object
show all
Defined in:
lib/leftovers/config_loader/scalar_value_schema.rb

Class Method Summary collapse

Methods inherited from Schema

===, error

Class Method Details

.to_ruby(node) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/leftovers/config_loader/scalar_value_schema.rb', line 12

def to_ruby(node)
  if node.to_ruby.nil?
    :_leftovers_nil_value
  else
    node.to_ruby
  end
end

.validate(node) ⇒ Object



7
8
9
10
# File 'lib/leftovers/config_loader/scalar_value_schema.rb', line 7

def validate(node)
  error(node, 'be any scalar value') unless node.scalar?
  super
end