Class: Cucumber::Ast::Features
Instance Attribute Summary collapse
-
#scenarios ⇒ Object
readonly
Returns the value of attribute scenarios.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #add_feature(feature) ⇒ Object
-
#initialize(filter) ⇒ Features
constructor
A new instance of Features.
- #scenario_executed(scenario) ⇒ Object
- #step_executed(step) ⇒ Object
- #visit?(node, lines) ⇒ Boolean
Constructor Details
#initialize(filter) ⇒ Features
Returns a new instance of Features.
6 7 8 9 10 11 12 |
# File 'lib/cucumber/ast/features.rb', line 6 def initialize(filter) @filter = filter @features = [] @scenarios = [] @steps = Hash.new{|steps, status| steps[status] = []} end |
Instance Attribute Details
#scenarios ⇒ Object (readonly)
Returns the value of attribute scenarios.
4 5 6 |
# File 'lib/cucumber/ast/features.rb', line 4 def scenarios @scenarios end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
4 5 6 |
# File 'lib/cucumber/ast/features.rb', line 4 def steps @steps end |
Instance Method Details
#accept(visitor) ⇒ Object
32 33 34 35 36 |
# File 'lib/cucumber/ast/features.rb', line 32 def accept(visitor) @features.each do |feature| visitor.visit_feature(feature) if visit?(feature, []) end end |
#add_feature(feature) ⇒ Object
14 15 16 17 |
# File 'lib/cucumber/ast/features.rb', line 14 def add_feature(feature) feature.features = self @features << feature end |
#scenario_executed(scenario) ⇒ Object
24 25 26 |
# File 'lib/cucumber/ast/features.rb', line 24 def scenario_executed(scenario) @scenarios << scenario end |
#step_executed(step) ⇒ Object
28 29 30 |
# File 'lib/cucumber/ast/features.rb', line 28 def step_executed(step) @steps[step.status] << step end |
#visit?(node, lines) ⇒ Boolean
19 20 21 22 |
# File 'lib/cucumber/ast/features.rb', line 19 def visit?(node, lines) @filter.matched?(node) && (lines.empty? ? true : node.at_lines?(lines)) end |