Class: LoadLibraryHandler
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
33
34
35
|
# File 'lib/javonet-ruby-sdk/core/handler/load_library_handler.rb', line 33
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
29
30
31
|
# 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
raise LoadError.new("Library not found: #{assembly_name}") unless File.exist?(assembly_name)
require(assembly_name)
@@loaded_libraries.push(assembly_name)
return 0
rescue Exception => e
return e
end
end
|