diff options
author | Jamis Buck <jamis@37signals.com> | 2008-04-10 10:47:17 -0600 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2008-04-10 10:47:17 -0600 |
commit | 546a4e9e21afaa0182108d1a1b47edfb3df2be0b (patch) | |
tree | 5e9c16b4a2959a3f522edcb0d87aa133b523ae59 | |
parent | 95429c249bfd39c7016f037242753f45fc0fd55d (diff) | |
download | net-ssh-multi-546a4e9e21afaa0182108d1a1b47edfb3df2be0b.tar.gz |
allow properties to be set, as well as queried
-rw-r--r-- | lib/net/ssh/multi/dynamic_server.rb | 6 | ||||
-rw-r--r-- | lib/net/ssh/multi/server.rb | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/net/ssh/multi/dynamic_server.rb b/lib/net/ssh/multi/dynamic_server.rb index 0fec55a..cbdde2b 100644 --- a/lib/net/ssh/multi/dynamic_server.rb +++ b/lib/net/ssh/multi/dynamic_server.rb @@ -40,6 +40,12 @@ module Net; module SSH; module Multi (options[:properties] ||= {})[key] end + # Sets the given key/value pair in the +:properties+ key in the options + # hash. If the options hash has no :properties key, it will be created. + def []=(key, value) + (options[:properties] ||= {})[key] = value + end + # Iterates over every instantiated server record in this dynamic server. # If the servers have not yet been instantiated, this does nothing (e.g., # it does _not_ automatically invoke #evaluate!). diff --git a/lib/net/ssh/multi/server.rb b/lib/net/ssh/multi/server.rb index f53adb8..41fd97c 100644 --- a/lib/net/ssh/multi/server.rb +++ b/lib/net/ssh/multi/server.rb @@ -61,7 +61,13 @@ module Net; module SSH; module Multi # properties are described via the +:properties+ key in the options hash # when defining the Server. def [](key) - (options[:properties] ||= {})[key] + (options[:properties] || {})[key] + end + + # Sets the given key/value pair in the +:properties+ key in the options + # hash. If the options hash has no :properties key, it will be created. + def []=(key, value) + (options[:properties] ||= {})[key] = value end # Returns the port number to use for this connection. |