Class: Cucumber::Core::Ast::Feature
- Inherits:
-
Object
- Object
- Cucumber::Core::Ast::Feature
- Includes:
- DescribesItself, HasLocation, Names
- Defined in:
- lib/cucumber/core/ast/feature.rb
Overview
Represents the root node of a parsed feature.
Instance Attribute Summary collapse
-
#background ⇒ Object
readonly
Returns the value of attribute background.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#feature_elements ⇒ Object
readonly
Returns the value of attribute feature_elements.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#language ⇒ Object
Returns the value of attribute language.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes included from Names
Instance Method Summary collapse
- #children ⇒ Object
- #gherkin_statement(statement = nil) ⇒ Object
-
#initialize ⇒ Feature
constructor
A new instance of Feature.
- #short_name ⇒ Object
- #to_sexp ⇒ Object
Methods included from DescribesItself
Methods included from HasLocation
#attributes, #file, #file_colon_line, #line, #match_locations?, #multiline_arg
Methods included from Names
Constructor Details
#initialize ⇒ Feature
Returns a new instance of Feature.
20 21 22 23 |
# File 'lib/cucumber/core/ast/feature.rb', line 20 def initialize(*) super feature_elements.each { |e| e.feature = self } end |
Instance Attribute Details
#background ⇒ Object (readonly)
Returns the value of attribute background.
17 18 19 |
# File 'lib/cucumber/core/ast/feature.rb', line 17 def background @background end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
17 18 19 |
# File 'lib/cucumber/core/ast/feature.rb', line 17 def comments @comments end |
#feature_elements ⇒ Object (readonly)
Returns the value of attribute feature_elements.
16 17 18 |
# File 'lib/cucumber/core/ast/feature.rb', line 16 def feature_elements @feature_elements end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
17 18 19 |
# File 'lib/cucumber/core/ast/feature.rb', line 17 def keyword @keyword end |
#language ⇒ Object
Returns the value of attribute language.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def language @language end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
17 18 19 |
# File 'lib/cucumber/core/ast/feature.rb', line 17 def location @location end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
17 18 19 |
# File 'lib/cucumber/core/ast/feature.rb', line 17 def @tags end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
17 18 19 |
# File 'lib/cucumber/core/ast/feature.rb', line 17 def title @title end |
Instance Method Details
#children ⇒ Object
29 30 31 |
# File 'lib/cucumber/core/ast/feature.rb', line 29 def children [background] + @feature_elements end |
#gherkin_statement(statement = nil) ⇒ Object
25 26 27 |
# File 'lib/cucumber/core/ast/feature.rb', line 25 def gherkin_statement(statement=nil) @gherkin_statement ||= statement end |
#short_name ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/cucumber/core/ast/feature.rb', line 33 def short_name first_line = name.split(/\n/)[0] if first_line =~ /#{language.keywords('feature')}:(.*)/ $1.strip else first_line end end |
#to_sexp ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cucumber/core/ast/feature.rb', line 42 def to_sexp sexp = [:feature, file, name] comment = @comment.to_sexp sexp += [comment] if comment = @tags.to_sexp sexp += if .any? sexp += [@background.to_sexp] if @background sexp += @feature_elements.map{|fe| fe.to_sexp} sexp end |