Class: GetStaticFieldHandler
- Inherits:
-
AbstractCommandHandler
show all
- Defined in:
- lib/javonet-ruby-sdk/core/handler/command_handler/get_static_field_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/command_handler/get_static_field_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/command_handler/get_static_field_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/command_handler/get_static_field_handler.rb
Instance Method Summary
collapse
#handle_command, #iterate
Constructor Details
Returns a new instance of GetStaticFieldHandler.
7
8
9
|
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/get_static_field_handler.rb', line 7
def initialize
@required_parameters_count = 2
end
|
Instance Method Details
#get_static_field(ruby_command) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/get_static_field_handler.rb', line 15
def get_static_field(ruby_command)
begin
if ruby_command.payload.length != @required_parameters_count
raise "Static field parameters mismatch"
end
merged_value = '@@' + ruby_command.payload[1]
if ruby_command.payload[0].class_variable_defined?(merged_value)
response = ruby_command.payload[0].class_variable_get(merged_value)
else
response = ruby_command.payload[0].const_get(ruby_command.payload[1])
end
return response
rescue Exception => e
return e
end
end
|
#process(ruby_command) ⇒ Object
11
12
13
|
# File 'lib/javonet-ruby-sdk/core/handler/command_handler/get_static_field_handler.rb', line 11
def process(ruby_command)
return get_static_field(ruby_command)
end
|