Class: Octothorpe::Storage
- Inherits:
- BasicObject
- Defined in:
- lib/octothorpe.rb
Overview
Inner class for storage. This is to minimise namespace collision with key names. Not exposed to Octothorpe’s caller.
Instance Attribute Summary collapse
-
#octothorpe_store ⇒ Object
readonly
Returns the value of attribute octothorpe_store.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Storage
constructor
A new instance of Storage.
- #method_missing(method, *attrs) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Storage
Returns a new instance of Storage.
64 65 66 |
# File 'lib/octothorpe.rb', line 64 def initialize(hash) @octothorpe_store = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *attrs) ⇒ Object
68 69 70 71 |
# File 'lib/octothorpe.rb', line 68 def method_missing(method, *attrs) super if (::Kernel.block_given? || !attrs.empty?) @octothorpe_store[method] end |
Instance Attribute Details
#octothorpe_store ⇒ Object (readonly)
Returns the value of attribute octothorpe_store.
62 63 64 |
# File 'lib/octothorpe.rb', line 62 def octothorpe_store @octothorpe_store end |