Class: Hiptest::ActionwordIndexer

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

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ActionwordIndexer

Returns a new instance of ActionwordIndexer.



35
36
37
38
39
# File 'lib/hiptest-publisher/call_arguments_adder.rb', line 35

def initialize(project)
  @project = project
  @indexed = {}
  index_actionwords
end

Instance Method Details

#get_index(name) ⇒ Object



59
60
61
# File 'lib/hiptest-publisher/call_arguments_adder.rb', line 59

def get_index(name)
  @indexed[name]
end

#index_actionwordsObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/hiptest-publisher/call_arguments_adder.rb', line 41

def index_actionwords
  @project.find_sub_nodes(Hiptest::Nodes::Actionword).each do |aw|
    aw_name = aw.children[:name]
    indexed_parameters = {}

    aw.children[:parameters].map do |param|
      param_name = param.children[:name]
      indexed_parameters[param_name] = param.children[:default]
    end

    @indexed[aw_name] = {
      :actionword => aw,
      :parameters => indexed_parameters
    }

  end
end