Class: Cucumber::Messages::Feature
- Defined in:
- lib/cucumber/messages/feature.rb
Overview
Represents the Feature message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Zero or more children.
-
#description ⇒ Object
readonly
The line(s) underneath the line with the ‘keyword` that are used as description.
-
#keyword ⇒ Object
readonly
The text of the ‘Feature` keyword (in the language specified by `language`).
-
#language ⇒ Object
readonly
The [ISO 639-1](en.wikipedia.org/wiki/ISO_639-1) language code of the Gherkin document.
-
#location ⇒ Object
readonly
The location of the ‘Feature` keyword.
-
#name ⇒ Object
readonly
The name of the feature (the text following the ‘keyword`).
-
#tags ⇒ Object
readonly
All the tags placed above the ‘Feature` keyword.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Feature from the given hash.
Instance Method Summary collapse
-
#initialize(location: Location.new, tags: [], language: '', keyword: '', name: '', description: '', children: []) ⇒ Feature
constructor
A new instance of Feature.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(location: Location.new, tags: [], language: '', keyword: '', name: '', description: '', children: []) ⇒ Feature
Returns a new instance of Feature.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cucumber/messages/feature.rb', line 46 def initialize( location: Location.new, tags: [], language: '', keyword: '', name: '', description: '', children: [] ) @location = location @tags = @language = language @keyword = keyword @name = name @description = description @children = children super() end |
Instance Attribute Details
#children ⇒ Object (readonly)
Zero or more children
44 45 46 |
# File 'lib/cucumber/messages/feature.rb', line 44 def children @children end |
#description ⇒ Object (readonly)
The line(s) underneath the line with the ‘keyword` that are used as description
39 40 41 |
# File 'lib/cucumber/messages/feature.rb', line 39 def description @description end |
#keyword ⇒ Object (readonly)
The text of the ‘Feature` keyword (in the language specified by `language`)
29 30 31 |
# File 'lib/cucumber/messages/feature.rb', line 29 def keyword @keyword end |
#language ⇒ Object (readonly)
The [ISO 639-1](en.wikipedia.org/wiki/ISO_639-1) language code of the Gherkin document
24 25 26 |
# File 'lib/cucumber/messages/feature.rb', line 24 def language @language end |
#location ⇒ Object (readonly)
The location of the ‘Feature` keyword
14 15 16 |
# File 'lib/cucumber/messages/feature.rb', line 14 def location @location end |
#name ⇒ Object (readonly)
The name of the feature (the text following the ‘keyword`)
34 35 36 |
# File 'lib/cucumber/messages/feature.rb', line 34 def name @name end |
#tags ⇒ Object (readonly)
All the tags placed above the ‘Feature` keyword
19 20 21 |
# File 'lib/cucumber/messages/feature.rb', line 19 def @tags end |
Class Method Details
.from_h(hash) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/cucumber/messages/feature.rb', line 72 def self.from_h(hash) return nil if hash.nil? new( location: Location.from_h(hash[:location]), tags: hash[:tags]&.map { |item| Tag.from_h(item) }, language: hash[:language], keyword: hash[:keyword], name: hash[:name], description: hash[:description], children: hash[:children]&.map { |item| FeatureChild.from_h(item) } ) end |