Class: Nasl::Block
- Includes:
- Enumerable
- Defined in:
- lib/nasl/parser/block.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Attributes inherited from Node
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(tree, *tokens) ⇒ Block
constructor
A new instance of Block.
Methods inherited from Node
Constructor Details
#initialize(tree, *tokens) ⇒ Block
Returns a new instance of Block.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nasl/parser/block.rb', line 35 def initialize(tree, *tokens) super if (@tokens.length == 4) @body = [@tokens[1]] + @tokens[2] elsif (@tokens.length == 3) @body = @tokens[1] else @body = [] end @children << :body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
31 32 33 |
# File 'lib/nasl/parser/block.rb', line 31 def body @body end |
Instance Method Details
#each ⇒ Object
49 50 51 |
# File 'lib/nasl/parser/block.rb', line 49 def each @body.each{ |stmt| yield stmt } end |