Class: Wally::CountsTags
- Inherits:
-
Object
- Object
- Wally::CountsTags
- Defined in:
- lib/wally/counts_tags.rb
Instance Method Summary collapse
- #count_tags ⇒ Object
-
#initialize(project) ⇒ CountsTags
constructor
A new instance of CountsTags.
Constructor Details
#initialize(project) ⇒ CountsTags
Returns a new instance of CountsTags.
3 4 5 |
# File 'lib/wally/counts_tags.rb', line 3 def initialize project @project = project end |
Instance Method Details
#count_tags ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wally/counts_tags.rb', line 7 def @project.features.inject(Hash.new(0)) do |tag_count, feature| if feature.gherkin["tags"] feature.gherkin["tags"].each do |tag| tag_count[tag["name"].downcase] += 1 end end if feature.gherkin["elements"] feature.gherkin["elements"].each do |element| if element["tags"] element["tags"].each do |tag| tag_count[tag["name"].downcase] += 1 end end end end tag_count end end |