Module: IndiferentHash
- Defined in:
- lib/rbbt/util/misc.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.setup(hash) ⇒ Object
1359 1360 1361 |
# File 'lib/rbbt/util/misc.rb', line 1359 def self.setup(hash) hash.extend IndiferentHash end |
Instance Method Details
#[](key) ⇒ Object
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
# File 'lib/rbbt/util/misc.rb', line 1363 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
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 |
# File 'lib/rbbt/util/misc.rb', line 1391 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
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 |
# File 'lib/rbbt/util/misc.rb', line 1380 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
1376 1377 1378 |
# File 'lib/rbbt/util/misc.rb', line 1376 def values_at(*key_list) key_list.inject([]){|acc,key| acc << self[key]} end |