Class: Nasl::Comment

Inherits:
Node
  • Object
show all
Defined in:
lib/nasl/parser/comment.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) ⇒ Comment

Returns a new instance of Comment.



33
34
35
36
37
38
39
40
# File 'lib/nasl/parser/comment.rb', line 33

def initialize(tree, *tokens)
  super

  @text = @tokens.first
  @next = @tokens.last

  @next = nil if @tokens.length == 1
end

Instance Attribute Details

#nextObject (readonly)

Returns the value of attribute next.



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

def next
  @next
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#to_xml(xml) ⇒ Object



42
43
44
# File 'lib/nasl/parser/comment.rb', line 42

def to_xml(xml)
  xml.comment(@text)
end