Class: Cucumber::Messages::PickleDocString
- Defined in:
- lib/cucumber/messages/pickle_doc_string.rb
Overview
Represents the PickleDocString message in Cucumber's message protocol.
Instance Attribute Summary collapse
-
#argument_index ⇒ Object
readonly
Returns the value of attribute argument_index.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#media_type ⇒ Object
readonly
Returns the value of attribute media_type.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new PickleDocString from the given hash.
Instance Method Summary collapse
-
#initialize(argument_index: nil, media_type: nil, content: '') ⇒ PickleDocString
constructor
A new instance of PickleDocString.
Methods inherited from Message
camelize, from_json, #to_h, #to_json, #type
Constructor Details
#initialize(argument_index: nil, media_type: nil, content: '') ⇒ PickleDocString
Returns a new instance of PickleDocString.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cucumber/messages/pickle_doc_string.rb', line 17 def initialize( argument_index: nil, media_type: nil, content: '' ) @argument_index = argument_index @media_type = media_type @content = content super() end |
Instance Attribute Details
#argument_index ⇒ Object (readonly)
Returns the value of attribute argument_index.
11 12 13 |
# File 'lib/cucumber/messages/pickle_doc_string.rb', line 11 def argument_index @argument_index end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
15 16 17 |
# File 'lib/cucumber/messages/pickle_doc_string.rb', line 15 def content @content end |
#media_type ⇒ Object (readonly)
Returns the value of attribute media_type.
13 14 15 |
# File 'lib/cucumber/messages/pickle_doc_string.rb', line 13 def media_type @media_type end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new PickleDocString from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::PickleDocString.from_h(some_hash) # => #<Cucumber::Messages::PickleDocString:0x... ...>
35 36 37 38 39 40 41 42 43 |
# File 'lib/cucumber/messages/pickle_doc_string.rb', line 35 def self.from_h(hash) return nil if hash.nil? new( argument_index: hash[:argumentIndex], media_type: hash[:mediaType], content: hash[:content] ) end |