Class: Ferry::Configuration::Server::Properties
- Inherits:
-
Object
- Object
- Ferry::Configuration::Server::Properties
show all
- Defined in:
- lib/ferry/configuration/server.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Properties.
80
81
82
|
# File 'lib/ferry/configuration/server.rb', line 80
def initialize
@properties = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, value = nil) ⇒ Object
113
114
115
116
117
118
119
|
# File 'lib/ferry/configuration/server.rb', line 113
def method_missing(key, value=nil)
if value
set(lvalue(key), value)
else
fetch(key)
end
end
|
Instance Method Details
#fetch(key) ⇒ Object
97
98
99
|
# File 'lib/ferry/configuration/server.rb', line 97
def fetch(key)
@properties[key]
end
|
#keys ⇒ Object
109
110
111
|
# File 'lib/ferry/configuration/server.rb', line 109
def keys
@properties.keys
end
|
#respond_to?(method, include_all = false) ⇒ Boolean
101
102
103
|
# File 'lib/ferry/configuration/server.rb', line 101
def respond_to?(method, include_all=false)
@properties.has_key?(method)
end
|
#roles ⇒ Object
105
106
107
|
# File 'lib/ferry/configuration/server.rb', line 105
def roles
@roles ||= Set.new
end
|
#set(key, value) ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/ferry/configuration/server.rb', line 84
def set(key, value)
pval = @properties[key]
if pval.is_a? Hash and value.is_a? Hash
pval.merge!(value)
elsif pval.is_a? Set and value.is_a? Set
pval.merge(value)
elsif pval.is_a? Array and value.is_a? Array
pval.concat value
else
@properties[key] = value
end
end
|