Class: Nasl::Identifier

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

Returns a new instance of Identifier.



34
35
36
37
38
# File 'lib/nasl/parser/identifier.rb', line 34

def initialize(tree, *tokens)
  super

  @name = @tokens.first.body
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



32
33
34
# File 'lib/nasl/parser/identifier.rb', line 32

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



40
41
42
# File 'lib/nasl/parser/identifier.rb', line 40

def <=>(other)
  self.name <=> other.name
end

#to_xml(xml) ⇒ Object



44
45
46
# File 'lib/nasl/parser/identifier.rb', line 44

def to_xml(xml)
  xml.identifier(:name=>@name)
end