Class: Hiptest::AnnotationsCounter
- Inherits:
-
Object
- Object
- Hiptest::AnnotationsCounter
- Defined in:
- lib/hiptest-publisher/gherkin_adder.rb
Instance Method Summary collapse
- #actionwords ⇒ Object
- #all_used_annotations(actionword) ⇒ Object
- #increment(actionword, annotation) ⇒ Object
-
#initialize ⇒ AnnotationsCounter
constructor
A new instance of AnnotationsCounter.
- #most_used_annotation(actionword) ⇒ Object
Constructor Details
#initialize ⇒ AnnotationsCounter
216 217 218 |
# File 'lib/hiptest-publisher/gherkin_adder.rb', line 216 def initialize @counts_by_actionword = Hash.new {|counts, actionword| counts[actionword] = Hash.new(0) } end |
Instance Method Details
#actionwords ⇒ Object
220 221 222 |
# File 'lib/hiptest-publisher/gherkin_adder.rb', line 220 def actionwords @counts_by_actionword.keys end |
#all_used_annotations(actionword) ⇒ Object
234 235 236 |
# File 'lib/hiptest-publisher/gherkin_adder.rb', line 234 def all_used_annotations(actionword) @counts_by_actionword[actionword].keys end |
#increment(actionword, annotation) ⇒ Object
224 225 226 227 |
# File 'lib/hiptest-publisher/gherkin_adder.rb', line 224 def increment(actionword, annotation) counts = @counts_by_actionword[actionword] counts[annotation] += 1 if annotation end |
#most_used_annotation(actionword) ⇒ Object
229 230 231 232 |
# File 'lib/hiptest-publisher/gherkin_adder.rb', line 229 def most_used_annotation(actionword) max = @counts_by_actionword[actionword].values.max @counts_by_actionword[actionword].key(max) end |