Class: Nasl::Case

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

Returns a new instance of Case.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/nasl/parser/case.rb', line 33

def initialize(tree, *tokens)
  super

  if @tokens.length == 3
    @case_op = nil 
    @case_val = @tokens[1]
    @case_type = 'normal'
  elsif @tokens.length == 6
    @case_op = @tokens[2]
    @case_val = @tokens[4]
    @case_type = 'normal_with_op'
  else
    @case_op = nil 
    @case_val = nil
    @case_type = 'default'
  end

  @children << :case_val
  @children << :case_op
  @children << :case_type
end

Instance Attribute Details

#case_opObject (readonly)

Returns the value of attribute case_op.



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

def case_op
  @case_op
end

#case_typeObject (readonly)

Returns the value of attribute case_type.



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

def case_type
  @case_type
end

#case_valObject (readonly)

Returns the value of attribute case_val.



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

def case_val
  @case_val
end