Class: Nasl::Call

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

Returns a new instance of Call.



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

def initialize(tree, *tokens)
  super

  @name = @tokens[0]

  @args = if @tokens[2].is_a? ::Array then @tokens[2] else [] end

  @arg = {}
  @args.select { |a| a.type == :named }.each do |a|
    @arg[a.name.name] = a.expr
  end

  @children << :name
  @children << :args
end

Instance Attribute Details

#argObject (readonly)

Returns the value of attribute arg.



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

def arg
  @arg
end

#argsObject (readonly)

Returns the value of attribute args.



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

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end