Class: Nasl::Ip

Inherits:
Node
  • Object
show all
Defined in:
lib/nasl/parser/ip.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#ctx, #tokens

Instance Method Summary collapse

Methods inherited from Node

#context, #region

Constructor Details

#initialize(tree, *tokens) ⇒ Ip

Returns a new instance of Ip.



33
34
35
36
37
# File 'lib/nasl/parser/ip.rb', line 33

def initialize(tree, *tokens)
  super

  @octets = [@tokens[0], @tokens[2], @tokens[4], @tokens[6]]
end

Instance Attribute Details

#octetsObject (readonly)

Returns the value of attribute octets.



31
32
33
# File 'lib/nasl/parser/ip.rb', line 31

def octets
  @octets
end

Instance Method Details

#to_xml(xml) ⇒ Object



39
40
41
# File 'lib/nasl/parser/ip.rb', line 39

def to_xml(xml)
  xml.ip(:octets=>@octets.join('.'))
end