Class: Foxtail::Bundle::Parser::AST::NumberLiteral

Inherits:
Data
  • Object
show all
Defined in:
lib/foxtail/bundle/parser/ast.rb,
lib/foxtail/bundle/parser/ast.rb

Overview

Number literal expression in Fluent patterns

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, precision: 0) ⇒ NumberLiteral

Returns a new instance of NumberLiteral.

Parameters:

  • value (Numeric, String)

    The numeric value (will be converted to Float)

  • precision (Integer) (defaults to: 0)

    Number of decimal places (default: 0)



26
# File 'lib/foxtail/bundle/parser/ast.rb', line 26

def initialize(value:, precision: 0) = super(value: Float(value), precision: Integer(precision))

Instance Attribute Details

#precisionObject (readonly)

Integer

Number of decimal places



23
24
25
# File 'lib/foxtail/bundle/parser/ast.rb', line 23

def precision
  @precision
end

#valueObject (readonly)

Float

The numeric value



23
24
25
# File 'lib/foxtail/bundle/parser/ast.rb', line 23

def value
  @value
end