Class: Nasl::Argument

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

Instance Attribute Summary collapse

Attributes inherited from Node

#ctx, #tokens

Instance Method Summary collapse

Methods inherited from Node

#context, #region, #to_xml

Constructor Details

#initialize(tree, *tokens) ⇒ Argument

Returns a new instance of Argument.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/nasl/parser/argument.rb', line 33

def initialize(tree, *tokens)
  super

  if @tokens.length == 3
    @name = @tokens.first
    @expr = @tokens.last
    @type = :named
  else
    @name = nil
    @expr = @tokens.first
    @type = :anonymous
  end

  @attributes << :type
  @children << :name
  @children << :expr
end

Instance Attribute Details

#exprObject (readonly)

Returns the value of attribute expr.



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

def expr
  @expr
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end