Class: Nasl::If

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

Returns a new instance of If.



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

def initialize(tree, *tokens)
  super

  @cond = @tokens[2]
  @true = @tokens[4]
  @false = if @tokens.length == 7 then @tokens.last else nil end

  @children << :cond
  @children << :true
  @children << :false
end

Instance Attribute Details

#condObject (readonly)

Returns the value of attribute cond.



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

def cond
  @cond
end

#falseObject (readonly)

Returns the value of attribute false.



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

def false
  @false
end

#trueObject (readonly)

Returns the value of attribute true.



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

def true
  @true
end