Class: Cucumber::Messages::JavaStackTraceElement

Inherits:
Message
  • Object
show all
Defined in:
lib/cucumber/messages/java_stack_trace_element.rb

Overview

Represents the JavaStackTraceElement message in Cucumber’s message protocol.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

camelize, from_json, #to_h, #to_json

Constructor Details

#initialize(class_name: '', file_name: '', method_name: '') ⇒ JavaStackTraceElement

Returns a new instance of JavaStackTraceElement.



17
18
19
20
21
22
23
24
25
26
# File 'lib/cucumber/messages/java_stack_trace_element.rb', line 17

def initialize(
  class_name: '',
  file_name: '',
  method_name: ''
)
  @class_name = class_name
  @file_name = file_name
  @method_name = method_name
  super()
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



11
12
13
# File 'lib/cucumber/messages/java_stack_trace_element.rb', line 11

def class_name
  @class_name
end

#file_nameObject (readonly)

Returns the value of attribute file_name.



13
14
15
# File 'lib/cucumber/messages/java_stack_trace_element.rb', line 13

def file_name
  @file_name
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



15
16
17
# File 'lib/cucumber/messages/java_stack_trace_element.rb', line 15

def method_name
  @method_name
end

Class Method Details

.from_h(hash) ⇒ Object

Returns a new JavaStackTraceElement from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::JavaStackTraceElement.from_h(some_hash) # => #<Cucumber::Messages::JavaStackTraceElement:0x... ...>


35
36
37
38
39
40
41
42
43
# File 'lib/cucumber/messages/java_stack_trace_element.rb', line 35

def self.from_h(hash)
  return nil if hash.nil?

  new(
    class_name: hash[:className],
    file_name: hash[:fileName],
    method_name: hash[:methodName]
  )
end