Class: Bureaucrat::Utils::StringAccessHash
- Inherits:
-
Hash
- Object
- Hash
- Bureaucrat::Utils::StringAccessHash
- Defined in:
- lib/bureaucrat/utils.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
- #fetch(key, *args) ⇒ Object
- #include?(key) ⇒ Boolean
-
#initialize(other = {}) ⇒ StringAccessHash
constructor
A new instance of StringAccessHash.
- #merge(other) ⇒ Object
- #update(other) ⇒ Object
Constructor Details
#initialize(other = {}) ⇒ StringAccessHash
Returns a new instance of StringAccessHash.
17 18 19 20 |
# File 'lib/bureaucrat/utils.rb', line 17 def initialize(other = {}) super() update(other) end |
Instance Method Details
#[](key) ⇒ Object
26 27 28 |
# File 'lib/bureaucrat/utils.rb', line 26 def [](key) super(key.to_s) end |
#[]=(key, value) ⇒ Object
22 23 24 |
# File 'lib/bureaucrat/utils.rb', line 22 def []=(key, value) super(key.to_s, value) end |
#delete(key) ⇒ Object
47 48 49 |
# File 'lib/bureaucrat/utils.rb', line 47 def delete(key) super(key.to_s) end |
#fetch(key, *args) ⇒ Object
30 31 32 |
# File 'lib/bureaucrat/utils.rb', line 30 def fetch(key, *args) super(key.to_s, *args) end |
#include?(key) ⇒ Boolean
34 35 36 |
# File 'lib/bureaucrat/utils.rb', line 34 def include?(key) super(key.to_s) end |
#merge(other) ⇒ Object
43 44 45 |
# File 'lib/bureaucrat/utils.rb', line 43 def merge(other) dup.update(other) end |
#update(other) ⇒ Object
38 39 40 41 |
# File 'lib/bureaucrat/utils.rb', line 38 def update(other) other.each_pair{|k, v| self[k] = v} self end |