Module: Cucumber::FeatureElement
- Included in:
- Ast::Background, Ast::Scenario, Ast::ScenarioOutline
- Defined in:
- lib/cucumber/ast/feature_element.rb
Instance Method Summary collapse
- #attach_steps(steps) ⇒ Object
- #backtrace_line(name = "#{@keyword} #{@name}", line = @line) ⇒ Object
- #file_colon_line(line = @line) ⇒ Object
- #matches_scenario_names?(scenario_names) ⇒ Boolean
- #max_line_length ⇒ Object
-
#previous_step(step) ⇒ Object
TODO: Remove when we use StepCollection everywhere.
- #source_indent(text_length) ⇒ Object
- #text_length ⇒ Object
Instance Method Details
#attach_steps(steps) ⇒ Object
3 4 5 |
# File 'lib/cucumber/ast/feature_element.rb', line 3 def attach_steps(steps) steps.each {|step| step.feature_element = self} end |
#backtrace_line(name = "#{@keyword} #{@name}", line = @line) ⇒ Object
19 20 21 |
# File 'lib/cucumber/ast/feature_element.rb', line 19 def backtrace_line(name = "#{@keyword} #{@name}", line = @line) @feature.backtrace_line(name, line) if @feature end |
#file_colon_line(line = @line) ⇒ Object
7 8 9 |
# File 'lib/cucumber/ast/feature_element.rb', line 7 def file_colon_line(line = @line) @feature.file_colon_line(line) if @feature end |
#matches_scenario_names?(scenario_names) ⇒ Boolean
15 16 17 |
# File 'lib/cucumber/ast/feature_element.rb', line 15 def matches_scenario_names?(scenario_names) scenario_names.detect{|name| name == @name} end |
#max_line_length ⇒ Object
27 28 29 |
# File 'lib/cucumber/ast/feature_element.rb', line 27 def max_line_length @steps.max_line_length(self) end |
#previous_step(step) ⇒ Object
TODO: Remove when we use StepCollection everywhere
32 33 34 35 |
# File 'lib/cucumber/ast/feature_element.rb', line 32 def previous_step(step) i = @steps.index(step) || -1 @steps[i-1] end |
#source_indent(text_length) ⇒ Object
23 24 25 |
# File 'lib/cucumber/ast/feature_element.rb', line 23 def source_indent(text_length) max_line_length - text_length end |
#text_length ⇒ Object
11 12 13 |
# File 'lib/cucumber/ast/feature_element.rb', line 11 def text_length @keyword.jlength + @name.jlength end |