Class: Cucumber::Messages::GherkinDocument
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb
Overview
Represents the GherkinDocument message in Cucumber’s message protocol.
*
The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document.
Cucumber implementations should *not* depend on `GherkinDocument` or any of its
children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead.
The only consumers of `GherkinDocument` should only be formatters that produce
"rich" output, resembling the original Gherkin document.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
All the comments in the Gherkin document.
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#uri ⇒ Object
readonly
-
The [URI](en.wikipedia.org/wiki/Uniform_Resource_Identifier) of the source, typically a file path relative to the root directory.
-
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new GherkinDocument from the given hash.
Instance Method Summary collapse
-
#initialize(uri: nil, feature: nil, comments: []) ⇒ GherkinDocument
constructor
A new instance of GherkinDocument.
Methods included from Message::Utils
Methods included from Message::Serialization
Methods included from Message::Deserialization
Constructor Details
#initialize(uri: nil, feature: nil, comments: []) ⇒ GherkinDocument
Returns a new instance of GherkinDocument.
254 255 256 257 258 259 260 261 262 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 254 def initialize( uri: nil, feature: nil, comments: [] ) @uri = uri @feature = feature @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
All the comments in the Gherkin document
252 253 254 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 252 def comments @comments end |
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
247 248 249 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 247 def feature @feature end |
#uri ⇒ Object (readonly)
*
The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)
of the source, typically a file path relative to the root directory
245 246 247 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 245 def uri @uri end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new GherkinDocument from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::GherkinDocument.from_h(some_hash) # => #<Cucumber::Messages::GherkinDocument:0x... ...>
101 102 103 104 105 106 107 108 109 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 101 def self.from_h(hash) return nil if hash.nil? self.new( uri: hash[:uri], feature: Feature.from_h(hash[:feature]), comments: hash[:comments]&.map { |item| Comment.from_h(item) }, ) end |