Class: LoadLibraryHandler
Constant Summary
collapse
- @@loaded_libraries =
[]
Class Method Summary
collapse
Instance Method Summary
collapse
#handle_command, #validate
Constructor Details
Returns a new instance of LoadLibraryHandler.
8
9
10
|
# File 'lib/hypertube-ruby-sdk/core/handler/load_library_handler.rb', line 8
def initialize
@required_parameters_count = 1
end
|
Class Method Details
.get_loaded_libraries ⇒ Object
33
34
35
|
# File 'lib/hypertube-ruby-sdk/core/handler/load_library_handler.rb', line 33
def self.get_loaded_libraries
@@loaded_libraries
end
|
Instance Method Details
#process(command) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/hypertube-ruby-sdk/core/handler/load_library_handler.rb', line 12
def process(command)
validate(command, @required_parameters_count, self.class.name)
assembly_name = command.payload[0]
expanded_path = File.expand_path(assembly_name)
raise LoadError.new("Library not found: #{assembly_name}") unless File.exist?(expanded_path)
normalized_path = normalize_path(expanded_path)
if File.directory?(normalized_path)
load_ruby_files_from_directory(normalized_path)
else
load_ruby_file(normalized_path)
end
0
end
|