Class: Cucumber::Messages::SourceReference
- Defined in:
- lib/cucumber/messages/source_reference.rb
Overview
Represents the SourceReference message in Cucumber’s message protocol.
Points to a [Source](#io.cucumber.messages.Source) identified by ‘uri` and a [Location](#io.cucumber.messages.Location) within that file.
Instance Attribute Summary collapse
-
#java_method ⇒ Object
readonly
Returns the value of attribute java_method.
-
#java_stack_trace_element ⇒ Object
readonly
Returns the value of attribute java_stack_trace_element.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new SourceReference from the given hash.
Instance Method Summary collapse
-
#initialize(uri: nil, java_method: nil, java_stack_trace_element: nil, location: nil) ⇒ SourceReference
constructor
A new instance of SourceReference.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(uri: nil, java_method: nil, java_stack_trace_element: nil, location: nil) ⇒ SourceReference
Returns a new instance of SourceReference.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cucumber/messages/source_reference.rb', line 22 def initialize( uri: nil, java_method: nil, java_stack_trace_element: nil, location: nil ) @uri = uri @java_method = java_method @java_stack_trace_element = java_stack_trace_element @location = location super() end |
Instance Attribute Details
#java_method ⇒ Object (readonly)
Returns the value of attribute java_method.
16 17 18 |
# File 'lib/cucumber/messages/source_reference.rb', line 16 def java_method @java_method end |
#java_stack_trace_element ⇒ Object (readonly)
Returns the value of attribute java_stack_trace_element.
18 19 20 |
# File 'lib/cucumber/messages/source_reference.rb', line 18 def java_stack_trace_element @java_stack_trace_element end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
20 21 22 |
# File 'lib/cucumber/messages/source_reference.rb', line 20 def location @location end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
14 15 16 |
# File 'lib/cucumber/messages/source_reference.rb', line 14 def uri @uri end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new SourceReference from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::SourceReference.from_h(some_hash) # => #<Cucumber::Messages::SourceReference:0x... ...>
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cucumber/messages/source_reference.rb', line 42 def self.from_h(hash) return nil if hash.nil? new( uri: hash[:uri], java_method: JavaMethod.from_h(hash[:javaMethod]), java_stack_trace_element: JavaStackTraceElement.from_h(hash[:javaStackTraceElement]), location: Location.from_h(hash[:location]) ) end |