Class: LoadLibraryHandler
- Inherits:
-
AbstractCommandHandler
show all
- Defined in:
- lib/javonet-ruby-sdk/core/handler/load_library_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Linux/X64/core/handler/load_library_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/MacOs/X64/core/handler/load_library_handler.rb,
lib/javonet-ruby-sdk/Binaries/Ruby/Windows/X64/core/handler/load_library_handler.rb
Constant Summary
collapse
- @@loaded_libraries =
[]
Class Method Summary
collapse
Instance Method Summary
collapse
#handle_command, #iterate
Constructor Details
Returns a new instance of LoadLibraryHandler.
7
8
9
|
# File 'lib/javonet-ruby-sdk/core/handler/load_library_handler.rb', line 7
def initialize
@required_parameters_count = 1
end
|
Class Method Details
.get_loaded_libraries ⇒ Object
30
31
32
|
# File 'lib/javonet-ruby-sdk/core/handler/load_library_handler.rb', line 30
def self.get_loaded_libraries
@@loaded_libraries
end
|
Instance Method Details
#process(command) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/javonet-ruby-sdk/core/handler/load_library_handler.rb', line 11
def process(command)
begin
if command.payload.length < @required_parameters_count
raise ArgumentError.new "Load library parameters mismatch"
end
if command.payload.length > @required_parameters_count
assembly_name = command.payload[1]
else
assembly_name = command.payload[0]
end
require(assembly_name)
@@loaded_libraries.push(assembly_name)
return 0
rescue Exception => e
return e
end
end
|