Class: Nasl::Function
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#fn_type ⇒ Object
readonly
Returns the value of attribute fn_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Attributes inherited from Node
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(tree, *tokens) ⇒ Function
constructor
A new instance of Function.
Methods inherited from Node
Constructor Details
#initialize(tree, *tokens) ⇒ Function
Returns a new instance of Function.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/nasl/parser/function.rb', line 33 def initialize(tree, *tokens) super @body = @tokens.last @fn_type = @tokens[1] if @fn_type == "obj" @name = @tokens[3] @attribute = @tokens[0] if @tokens.length == 8 @params = @tokens[5] else @params = [] end else @name = @tokens[2] @attribute = [] if @tokens.length == 7 @params = @tokens[4] else @params = [] end end @children << :name @children << :attribute @children << :params @children << :body @children << :fn_type end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
31 32 33 |
# File 'lib/nasl/parser/function.rb', line 31 def attribute @attribute end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
31 32 33 |
# File 'lib/nasl/parser/function.rb', line 31 def body @body end |
#fn_type ⇒ Object (readonly)
Returns the value of attribute fn_type.
31 32 33 |
# File 'lib/nasl/parser/function.rb', line 31 def fn_type @fn_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'lib/nasl/parser/function.rb', line 31 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
31 32 33 |
# File 'lib/nasl/parser/function.rb', line 31 def params @params end |
Instance Method Details
#each ⇒ Object
65 66 67 |
# File 'lib/nasl/parser/function.rb', line 65 def each @body.each{ |stmt| yield stmt } end |