Module: IndiferentHash
- Defined in:
- lib/rbbt/util/misc.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.setup(hash) ⇒ Object
1390 1391 1392 |
# File 'lib/rbbt/util/misc.rb', line 1390 def self.setup(hash) hash.extend IndiferentHash end |
Instance Method Details
#[](key) ⇒ Object
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 |
# File 'lib/rbbt/util/misc.rb', line 1394 def [](key) res = super(key) and return res case key when Symbol, Module super(key.to_s) when String super(key.to_sym) else super(key) end end |
#delete(key) ⇒ Object
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 |
# File 'lib/rbbt/util/misc.rb', line 1422 def delete(key) case key when Symbol, Module super(key) || super(key.to_s) when String super(key) || super(key.to_sym) else super(key) end end |
#include?(key) ⇒ Boolean
1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 |
# File 'lib/rbbt/util/misc.rb', line 1411 def include?(key) case key when Symbol, Module super(key) || super(key.to_s) when String super(key) || super(key.to_sym) else super(key) end end |
#values_at(*key_list) ⇒ Object
1407 1408 1409 |
# File 'lib/rbbt/util/misc.rb', line 1407 def values_at(*key_list) key_list.inject([]){|acc,key| acc << self[key]} end |