Class: Hiptest::ActionwordIndexer

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

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ActionwordIndexer

Returns a new instance of ActionwordIndexer.



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

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

Instance Method Details

#get_index(name) ⇒ Object



30
31
32
# File 'lib/hiptest-publisher/indexers/actionword_indexer.rb', line 30

def get_index(name)
  @indexed[name]
end

#get_uid_index(uid) ⇒ Object



34
35
36
# File 'lib/hiptest-publisher/indexers/actionword_indexer.rb', line 34

def get_uid_index(uid)
  @uid_indexed[uid]
end

#index_actionwordsObject



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

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

    data = {
      actionword: aw,
      parameters: indexed_parameters
    }

    @indexed[aw_name] = data
    @uid_indexed[aw.children[:uid]] = data
  end
end