Class: Cucumber::Ast::Features

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/cucumber/ast/features.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFeatures

Returns a new instance of Features.



8
9
10
# File 'lib/cucumber/ast/features.rb', line 8

def initialize
  @features = []
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



6
7
8
# File 'lib/cucumber/ast/features.rb', line 6

def duration
  @duration
end

Instance Method Details

#[](index) ⇒ Object



12
13
14
# File 'lib/cucumber/ast/features.rb', line 12

def [](index)
  @features[index]
end

#accept(visitor) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/cucumber/ast/features.rb', line 24

def accept(visitor)
  return if Cucumber.wants_to_quit
  start = Time.now
  self.each do |feature|
    visitor.visit_feature(feature)
  end
  @duration = Time.now - start
end

#add_feature(feature) ⇒ Object



20
21
22
# File 'lib/cucumber/ast/features.rb', line 20

def add_feature(feature)
  @features << feature
end

#each(&proc) ⇒ Object



16
17
18
# File 'lib/cucumber/ast/features.rb', line 16

def each(&proc)
  @features.each(&proc)
end

#step_countObject



33
34
35
# File 'lib/cucumber/ast/features.rb', line 33

def step_count
  @features.inject(0) { |total, feature| total += feature.step_count }
end