lib/cucumber/messages/step_definition.rb
# frozen_string_literal: true # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/codegen/codegen.rb] module Cucumber module Messages ## # Represents the StepDefinition message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## ## class StepDefinition < Message attr_reader :id attr_reader :pattern attr_reader :source_reference def initialize( id: '', pattern: StepDefinitionPattern.new, source_reference: SourceReference.new ) @id = id @pattern = pattern @source_reference = source_reference super() end ## # Returns a new StepDefinition from the given hash. # If the hash keys are camelCased, they are properly assigned to the # corresponding snake_cased attributes. # # Cucumber::Messages::StepDefinition.from_h(some_hash) # => #<Cucumber::Messages::StepDefinition:0x... ...> ## def self.from_h(hash) return nil if hash.nil? new( id: hash[:id], pattern: StepDefinitionPattern.from_h(hash[:pattern]), source_reference: SourceReference.from_h(hash[:sourceReference]) ) end end end end