Class: Hiptest::ActionwordIndexer

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

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ActionwordIndexer

Returns a new instance of ActionwordIndexer.



3
4
5
6
7
# File 'lib/hiptest-publisher/actionword_indexer.rb', line 3

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

Instance Method Details

#get_index(name) ⇒ Object



27
28
29
# File 'lib/hiptest-publisher/actionword_indexer.rb', line 27

def get_index(name)
  @indexed[name]
end

#index_actionwordsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hiptest-publisher/actionword_indexer.rb', line 9

def index_actionwords
  @project.each_sub_nodes(Hiptest::Nodes::Actionword) 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