Class: Hiptest::Nodes::ParameterTypeAdder

Inherits:
Walker
  • Object
show all
Defined in:
lib/hiptest-publisher/parameter_type_adder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Walker

#walk_node

Constructor Details

#initializeParameterTypeAdder

Returns a new instance of ParameterTypeAdder.



15
16
17
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 15

def initialize
  super(:parent_first)
end

Instance Attribute Details

#call_typesObject (readonly)

Returns the value of attribute call_types.



6
7
8
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 6

def call_types
  @call_types
end

Class Method Details

.add(project) ⇒ Object



8
9
10
11
12
13
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 8

def self.add(project)
  walker = Hiptest::Nodes::ParameterTypeAdder.new
  walker.walk_node(project)

  Hiptest::Nodes::TypeWriter.new(walker.call_types).walk_node(project)
end

Instance Method Details

#walk_actionword(actionword) ⇒ Object



33
34
35
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 33

def walk_actionword(actionword)
  @call_types.add_callable_item(actionword.children[:name])
end

#walk_argument(arg) ⇒ Object



27
28
29
30
31
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 27

def walk_argument(arg)
  get_literal_values(arg).each {|value|
    @call_types.add_argument(arg.children[:name], value[0], value[1])
  }
end

#walk_call(call) ⇒ Object



23
24
25
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 23

def walk_call(call)
  @call_types.add_callable_item(call.children[:actionword])
end

#walk_project(project) ⇒ Object



19
20
21
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 19

def walk_project(project)
  @call_types = CallTypes.new
end

#walk_scenario(scenario) ⇒ Object



37
38
39
# File 'lib/hiptest-publisher/parameter_type_adder.rb', line 37

def walk_scenario(scenario)
  @call_types.add_callable_item(scenario.children[:name])
end