Class: RubyHaze::Config
Instance Attribute Summary
#proxy_object
Class Method Summary
collapse
Instance Method Summary
collapse
included, #method_missing, #respond_to?
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
11
12
13
14
15
16
17
18
|
# File 'lib/rubyhaze/configs/config.rb', line 11
def initialize(options = {})
@proxy_object = Java::ComHazelcastConfig::Config.new
set_group options[:group]
set_network options[:network]
set_maps options[:maps]
set_queues options[:queues]
set_topics options[:topics]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class RubyHaze::Mixins::Proxy
Class Method Details
.new_from_yaml ⇒ Object
52
53
54
55
|
# File 'lib/rubyhaze/configs/config.rb', line 52
def new_from_yaml
hsh = yaml_hash
new(hsh) if hsh
end
|
.yaml_hash ⇒ Object
47
48
49
50
|
# File 'lib/rubyhaze/configs/config.rb', line 47
def yaml_hash
yml_path = File.expand_path('./hazelcast.yml')
YAML.load_file(yml_path) if File.file? yml_path
end
|
Instance Method Details
#set_group(options = nil) ⇒ Object
#set_maps(hash = nil) ⇒ Object
30
31
32
33
|
# File 'lib/rubyhaze/configs/config.rb', line 30
def set_maps(hash = nil)
return if hash.nil? || hash.empty?
proxy_object.setMapConfigs hash.map{ |name, options| RubyHaze::MapConfig.new(name, options).proxy_object }
end
|
#set_network(options = nil) ⇒ Object
#set_queues(hash = nil) ⇒ Object
35
36
37
38
|
# File 'lib/rubyhaze/configs/config.rb', line 35
def set_queues(hash = nil)
return if hash.nil? || hash.empty?
proxy_object.setMapQConfigs hash.map{ |name, options| RubyHaze::QueueConfig.new(name, options).proxy_object }
end
|
#set_topics(hash = nil) ⇒ Object
40
41
42
43
|
# File 'lib/rubyhaze/configs/config.rb', line 40
def set_topics(hash = nil)
return if hash.nil? || hash.empty?
proxy_object.setTopicConfigs hash.map{ |name, options| RubyHaze::TopicConfig.new(name, options).proxy_object }
end
|