class Nasl::Integer
Attributes
base[R]
value[R]
Public Class Methods
new(tree, *tokens)
click to toggle source
Calls superclass method
# File lib/nasl/parser/integer.rb, line 34 def initialize(tree, *tokens) super @base = case @tokens.first.type when :INT_DEC 10 when :INT_HEX 16 when :INT_OCT 8 when :FALSE 10 when :TRUE 10 end @value = case @tokens.first.type when :FALSE 0 when :TRUE 1 else @tokens.first.body.to_i(@base) end end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/nasl/parser/integer.rb, line 60 def <=>(other) self.value <=> other.value end
to_xml(xml)
click to toggle source
# File lib/nasl/parser/integer.rb, line 64 def to_xml(xml) case @tokens.first.type when :FALSE xml.false when :TRUE xml.true else xml.integer(:value=>@value) end end