Class: Nodepile::KeyedArrayAccessor::PseudoROHashForDeconstruct
- Inherits:
-
Object
- Object
- Nodepile::KeyedArrayAccessor::PseudoROHashForDeconstruct
- Defined in:
- lib/nodepile/keyed_array.rb
Overview
Internal implementation to optimize pattern matching Does two main things:
- Converts keys passed in to string type (allowing symbols to be used for pattern matching)
- Makes it looks like metadata and data occupy the same keyspace regardless of the setting of the @metadata_key_prefix
Instance Method Summary collapse
- #[](k) ⇒ Object
- #include?(k) ⇒ Boolean
-
#initialize(keyed_array) ⇒ PseudoROHashForDeconstruct
constructor
A new instance of PseudoROHashForDeconstruct.
Constructor Details
#initialize(keyed_array) ⇒ PseudoROHashForDeconstruct
353 |
# File 'lib/nodepile/keyed_array.rb', line 353 def initialize(keyed_array) = @kaa = keyed_array |
Instance Method Details
#[](k) ⇒ Object
355 |
# File 'lib/nodepile/keyed_array.rb', line 355 def [](k) = (@kaa..nil? ? (@kaa[k.to_s] || @kaa.(k.to_s)) : @kaa[k.to_s] ) |
#include?(k) ⇒ Boolean
354 |
# File 'lib/nodepile/keyed_array.rb', line 354 def include?(k) = @kaa.include?(k.to_s) || @kaa.(k.to_s) |