Skip to content

Commit 546a4e9

Browse files
committed
allow properties to be set, as well as queried
1 parent 95429c2 commit 546a4e9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/net/ssh/multi/dynamic_server.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def [](key)
4040
(options[:properties] ||= {})[key]
4141
end
4242

43+
# Sets the given key/value pair in the +:properties+ key in the options
44+
# hash. If the options hash has no :properties key, it will be created.
45+
def []=(key, value)
46+
(options[:properties] ||= {})[key] = value
47+
end
48+
4349
# Iterates over every instantiated server record in this dynamic server.
4450
# If the servers have not yet been instantiated, this does nothing (e.g.,
4551
# it does _not_ automatically invoke #evaluate!).

lib/net/ssh/multi/server.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ def initialize(master, host, options={})
6161
# properties are described via the +:properties+ key in the options hash
6262
# when defining the Server.
6363
def [](key)
64-
(options[:properties] ||= {})[key]
64+
(options[:properties] || {})[key]
65+
end
66+
67+
# Sets the given key/value pair in the +:properties+ key in the options
68+
# hash. If the options hash has no :properties key, it will be created.
69+
def []=(key, value)
70+
(options[:properties] ||= {})[key] = value
6571
end
6672

6773
# Returns the port number to use for this connection.

0 commit comments

Comments
 (0)