Class: FilterParam::AST::Literals::Integer

Inherits:
FilterParam::AST::Literal show all
Defined in:
lib/filter_param/ast/literals/integer.rb

Direct Known Subclasses

Decimal

Instance Attribute Summary

Attributes inherited from FilterParam::AST::Literal

#value

Instance Method Summary collapse

Methods inherited from FilterParam::AST::Literal

#type_cast

Methods inherited from Node

#accept

Constructor Details

#initialize(value) ⇒ Integer

Returns a new instance of Integer.



5
6
7
8
9
10
11
# File 'lib/filter_param/ast/literals/integer.rb', line 5

def initialize(value)
  whole_num = value.to_s.split(".").first

  @value = Integer(whole_num)
rescue ArgumentError
  raise InvalidLiteral.new("Invalid Integer: #{value}")
end

Instance Method Details

#data_typeObject



13
14
15
# File 'lib/filter_param/ast/literals/integer.rb', line 13

def data_type
  :integer
end