Module: Cucumber::FeatureElement
- Included in:
- Ast::Background, Ast::Scenario, Ast::ScenarioOutline
- Defined in:
- lib/cucumber/ast/feature_element.rb
Instance Attribute Summary collapse
-
#feature ⇒ Object
writeonly
Sets the attribute feature.
Instance Method Summary collapse
- #accept_hook?(hook) ⇒ Boolean
- #attach_steps(steps) ⇒ Object
- #backtrace_line(name = "#{@keyword} #{@name}", line = @line) ⇒ Object
- #file_colon_line(line = @line) ⇒ Object
- #first_line_length ⇒ Object
- #language ⇒ Object
- #matches_scenario_names?(scenario_name_regexps) ⇒ Boolean
- #max_line_length ⇒ Object
- #name_line_lengths ⇒ Object
- #source_indent(text_length) ⇒ Object
- #tag_count(tag) ⇒ Object
- #text_length ⇒ Object
Instance Attribute Details
#feature=(value) ⇒ Object (writeonly)
Sets the attribute feature
5 6 7 |
# File 'lib/cucumber/ast/feature_element.rb', line 5 def feature=(value) @feature = value end |
Instance Method Details
#accept_hook?(hook) ⇒ Boolean
49 50 51 |
# File 'lib/cucumber/ast/feature_element.rb', line 49 def accept_hook?(hook) @tags.accept_hook?(hook) || @feature.accept_hook?(hook) end |
#attach_steps(steps) ⇒ Object
7 8 9 |
# File 'lib/cucumber/ast/feature_element.rb', line 7 def attach_steps(steps) steps.each {|step| step.feature_element = self} end |
#backtrace_line(name = "#{@keyword} #{@name}", line = @line) ⇒ Object
37 38 39 |
# File 'lib/cucumber/ast/feature_element.rb', line 37 def backtrace_line(name = "#{@keyword} #{@name}", line = @line) @feature.backtrace_line(name, line) if @feature end |
#file_colon_line(line = @line) ⇒ Object
11 12 13 |
# File 'lib/cucumber/ast/feature_element.rb', line 11 def file_colon_line(line = @line) @feature.file_colon_line(line) if @feature end |
#first_line_length ⇒ Object
19 20 21 |
# File 'lib/cucumber/ast/feature_element.rb', line 19 def first_line_length name_line_lengths[0] end |
#language ⇒ Object
57 58 59 |
# File 'lib/cucumber/ast/feature_element.rb', line 57 def language @feature.language end |
#matches_scenario_names?(scenario_name_regexps) ⇒ Boolean
33 34 35 |
# File 'lib/cucumber/ast/feature_element.rb', line 33 def matches_scenario_names?(scenario_name_regexps) scenario_name_regexps.detect{|name| name =~ @name} end |
#max_line_length ⇒ Object
45 46 47 |
# File 'lib/cucumber/ast/feature_element.rb', line 45 def max_line_length @steps.max_line_length(self) end |
#name_line_lengths ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/cucumber/ast/feature_element.rb', line 23 def name_line_lengths if @name.empty? [@keyword.jlength] else @name.split("\n").enum_for(:each_with_index).map do |line, line_number| line_number == 0 ? @keyword.jlength + line.jlength : line.jlength + Ast::Step::INDENT - 1 # We -1 as names which are not keyword lines are missing a space between keyword and name end end end |
#source_indent(text_length) ⇒ Object
41 42 43 |
# File 'lib/cucumber/ast/feature_element.rb', line 41 def source_indent(text_length) max_line_length - text_length end |
#tag_count(tag) ⇒ Object
53 54 55 |
# File 'lib/cucumber/ast/feature_element.rb', line 53 def tag_count(tag) @feature.tag_count(tag) == 0 ? @tags.count(tag) : @feature.tag_count(tag) end |
#text_length ⇒ Object
15 16 17 |
# File 'lib/cucumber/ast/feature_element.rb', line 15 def text_length name_line_lengths.max end |