Class: Nasl::Array
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#pairs ⇒ Object
readonly
Returns the value of attribute pairs.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(tree, *tokens) ⇒ Array
constructor
A new instance of Array.
Methods inherited from Node
Constructor Details
#initialize(tree, *tokens) ⇒ Array
Returns a new instance of Array.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nasl/parser/array.rb', line 33 def initialize(tree, *tokens) super @pairs = if @tokens[1].is_a? ::Array then @tokens[1] else [] end @keys = Hash[@pairs.map do |p| if p.key.is_a? String k = p.key.text elsif p.key.is_a? Identifier k = p.key.name else k = p.key.value end [k, p.value] end] @children << :pairs end |