Class: Cucumber::Messages::StepDefinitionPattern
- Defined in:
- lib/cucumber/messages/step_definition_pattern.rb
Overview
Represents the StepDefinitionPattern message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new StepDefinitionPattern from the given hash.
Instance Method Summary collapse
-
#initialize(source: '', type: StepDefinitionPatternType::CUCUMBER_EXPRESSION) ⇒ StepDefinitionPattern
constructor
A new instance of StepDefinitionPattern.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(source: '', type: StepDefinitionPatternType::CUCUMBER_EXPRESSION) ⇒ StepDefinitionPattern
Returns a new instance of StepDefinitionPattern.
15 16 17 18 19 20 21 22 |
# File 'lib/cucumber/messages/step_definition_pattern.rb', line 15 def initialize( source: '', type: StepDefinitionPatternType::CUCUMBER_EXPRESSION ) @source = source @type = type super() end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
11 12 13 |
# File 'lib/cucumber/messages/step_definition_pattern.rb', line 11 def source @source end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
13 14 15 |
# File 'lib/cucumber/messages/step_definition_pattern.rb', line 13 def type @type end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new StepDefinitionPattern from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::StepDefinitionPattern.from_h(some_hash) # => #<Cucumber::Messages::StepDefinitionPattern:0x... ...>
31 32 33 34 35 36 37 38 |
# File 'lib/cucumber/messages/step_definition_pattern.rb', line 31 def self.from_h(hash) return nil if hash.nil? new( source: hash[:source], type: hash[:type] ) end |