Class: Pharrell::Config::ObjectGenerator
- Inherits:
-
Object
- Object
- Pharrell::Config::ObjectGenerator
- Defined in:
- lib/pharrell/config.rb
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(options = {}, &blk) ⇒ ObjectGenerator
constructor
A new instance of ObjectGenerator.
- #invalidate! ⇒ Object
Constructor Details
#initialize(options = {}, &blk) ⇒ ObjectGenerator
Returns a new instance of ObjectGenerator.
39 40 41 42 |
# File 'lib/pharrell/config.rb', line 39 def initialize( = {}, &blk) @blk = blk = end |
Instance Method Details
#fetch ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/pharrell/config.rb', line 44 def fetch if [:cache] @value ||= @blk.call else @blk.call end end |
#invalidate! ⇒ Object
52 53 54 |
# File 'lib/pharrell/config.rb', line 52 def invalidate! @value = nil end |