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.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#feature_elements ⇒ Object
readonly
Returns the value of attribute feature_elements.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Attributes included from Names
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(language, location, background, comments, tags, keyword, name, description, scenario_definitions) ⇒ Feature
constructor
A new instance of Feature.
- #short_name ⇒ Object
- #to_sexp ⇒ Object
Methods included from DescribesItself
Methods included from HasLocation
#all_locations, #attributes, #file, #file_colon_line, #line, #multiline_arg
Methods included from Names
#inspect, #legacy_conflated_name_and_description, #to_s
Constructor Details
#initialize(language, location, background, comments, tags, keyword, name, description, scenario_definitions) ⇒ Feature
Returns a new instance of Feature.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cucumber/core/ast/feature.rb', line 19 def initialize(language, location, background, comments, , keyword, name, description, scenario_definitions) @language = language @location = location @background = background @comments = comments @tags = @keyword = keyword @name = name @description = description @feature_elements = scenario_definitions end |
Instance Attribute Details
#background ⇒ Object (readonly)
Returns the value of attribute background.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def background @background end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def comments @comments end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def description @description end |
#feature_elements ⇒ Object (readonly)
Returns the value of attribute feature_elements.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def feature_elements @feature_elements end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def keyword @keyword end |
#language ⇒ Object (readonly)
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.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def location @location end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
15 16 17 |
# File 'lib/cucumber/core/ast/feature.rb', line 15 def @tags end |
Instance Method Details
#children ⇒ Object
31 32 33 |
# File 'lib/cucumber/core/ast/feature.rb', line 31 def children [background] + @feature_elements end |
#short_name ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/cucumber/core/ast/feature.rb', line 35 def short_name first_line = name.split(/\n/)[0] if first_line =~ /#{language.feature_keywords}:(.*)/ $1.strip else first_line end end |
#to_sexp ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cucumber/core/ast/feature.rb', line 44 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 |