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