Class: GetStaticFieldHandler
Instance Method Summary
collapse
#handle_command, #iterate
Constructor Details
Returns a new instance of GetStaticFieldHandler.
6
7
8
|
# File 'lib/javonet-ruby-sdk/core/handler/get_static_field_handler.rb', line 6
def initialize
@required_parameters_count = 2
end
|
Instance Method Details
#get_static_field(command) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/javonet-ruby-sdk/core/handler/get_static_field_handler.rb', line 14
def get_static_field(command)
raise ArgumentError.new 'Static field parameters mismatch' if command.payload.length != @required_parameters_count
type = command.payload[0]
value = command.payload[1]
begin
response = type.class_variable_get(value)
rescue StandardError
response = type.const_get(value)
end
response
end
|
#process(command) ⇒ Object
10
11
12
|
# File 'lib/javonet-ruby-sdk/core/handler/get_static_field_handler.rb', line 10
def process(command)
get_static_field(command)
end
|