Class: Hiptest::NodeModifiers::AnnotationsCounter

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

Instance Method Summary collapse

Constructor Details

#initializeAnnotationsCounter

Returns a new instance of AnnotationsCounter.



220
221
222
# File 'lib/hiptest-publisher/node_modifiers/gherkin_adder.rb', line 220

def initialize
  @counts_by_actionword = Hash.new {|counts, actionword| counts[actionword] = Hash.new(0) }
end

Instance Method Details

#actionwordsObject



224
225
226
# File 'lib/hiptest-publisher/node_modifiers/gherkin_adder.rb', line 224

def actionwords
  @counts_by_actionword.keys
end

#all_used_annotations(actionword) ⇒ Object



238
239
240
# File 'lib/hiptest-publisher/node_modifiers/gherkin_adder.rb', line 238

def all_used_annotations(actionword)
  @counts_by_actionword[actionword].keys
end

#increment(actionword, annotation) ⇒ Object



228
229
230
231
# File 'lib/hiptest-publisher/node_modifiers/gherkin_adder.rb', line 228

def increment(actionword, annotation)
  counts = @counts_by_actionword[actionword]
  counts[annotation] += 1 if annotation
end

#most_used_annotation(actionword) ⇒ Object



233
234
235
236
# File 'lib/hiptest-publisher/node_modifiers/gherkin_adder.rb', line 233

def most_used_annotation(actionword)
  max = @counts_by_actionword[actionword].values.max
  @counts_by_actionword[actionword].key(max)
end