Class: Babl::Nodes::Typed::Number

Inherits:
Base
  • Object
show all
Defined in:
lib/babl/nodes/typed.rb

Instance Method Summary collapse

Methods inherited from Base

#dependencies, #optimize, #pinned_dependencies

Instance Method Details

#render(frame) ⇒ Object



60
61
62
63
64
65
66
67
# File 'lib/babl/nodes/typed.rb', line 60

def render(frame)
    value = frame.object
    return value if ::Integer === value
    return value.to_f if ::Numeric === value

    raise Errors::RenderingError,
        "Expected a number, got #{value.inspect}\n#{frame.formatted_stack}"
end

#schemaObject



56
57
58
# File 'lib/babl/nodes/typed.rb', line 56

def schema
    Schema::Typed::NUMBER
end