Class: Cucumber::Messages::Source
- 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 Source message in Cucumber’s message protocol.
//// Source
*
A source file, typically a Gherkin document or Java/Ruby/JavaScript source code
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
The contents of the file.
-
#media_type ⇒ Object
readonly
The media type of the file.
-
#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 Source from the given hash.
Instance Method Summary collapse
-
#initialize(uri: '', data: '', media_type: SourceMediaType::TEXT_X_CUCUMBER_GHERKIN_PLAIN) ⇒ Source
constructor
A new instance of Source.
Methods included from Message::Utils
Methods included from Message::Serialization
Methods included from Message::Deserialization
Constructor Details
#initialize(uri: '', data: '', media_type: SourceMediaType::TEXT_X_CUCUMBER_GHERKIN_PLAIN) ⇒ Source
Returns a new instance of Source.
1325 1326 1327 1328 1329 1330 1331 1332 1333 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1325 def initialize( uri: '', data: '', media_type: SourceMediaType::TEXT_X_CUCUMBER_GHERKIN_PLAIN ) @uri = uri @data = data @media_type = media_type end |
Instance Attribute Details
#data ⇒ Object (readonly)
The contents of the file
1317 1318 1319 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1317 def data @data end |
#media_type ⇒ Object (readonly)
The media type of the file. Can be used to specify custom types, such as
text/x.cucumber.gherkin+plain
1323 1324 1325 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1323 def media_type @media_type 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
1312 1313 1314 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1312 def uri @uri end |
Class Method Details
.from_h(hash) ⇒ Object
774 775 776 777 778 779 780 781 782 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 774 def self.from_h(hash) return nil if hash.nil? self.new( uri: hash[:uri], data: hash[:data], media_type: hash[:mediaType], ) end |