Class: SSHKit::CommandMap::CommandHash
- Inherits:
-
Object
- Object
- SSHKit::CommandMap::CommandHash
- Defined in:
- lib/sshkit/command_map.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(defaults = {}) ⇒ CommandHash
constructor
A new instance of CommandHash.
Constructor Details
#initialize(defaults = {}) ⇒ CommandHash
Returns a new instance of CommandHash.
4 5 6 7 |
# File 'lib/sshkit/command_map.rb', line 4 def initialize(defaults = {}) @storage = {} @defaults = defaults end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 |
# File 'lib/sshkit/command_map.rb', line 9 def [](key) @storage[normalize_key(key)] ||= @defaults[key] end |
#[]=(key, value) ⇒ Object
13 14 15 |
# File 'lib/sshkit/command_map.rb', line 13 def []=(key, value) @storage[normalize_key(key)] = value end |