Class: Nasl::Object

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

Returns a new instance of Object.



35
36
37
38
39
40
41
42
43
# File 'lib/nasl/parser/object.rb', line 35

def initialize(tree, *tokens)
  super

  @body = if @tokens.length == 5 then @tokens[3] else [] end
  @name = @tokens[1]

  @children << :name
  @children << :body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#eachObject



45
46
47
# File 'lib/nasl/parser/object.rb', line 45

def each
  @body.each{ |stmt| yield stmt }
end