Class: GroovyOneliner::Cache
- Inherits:
-
Object
- Object
- GroovyOneliner::Cache
- Defined in:
- lib/groovy_oneliner/cache.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Cache
Returns a new instance of Cache.
6 7 8 |
# File 'lib/groovy_oneliner/cache.rb', line 6 def initialize @cache = {} end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/groovy_oneliner/cache.rb', line 10 def [](key) @cache[key] end |
#[]=(key, value) ⇒ Object
14 15 16 |
# File 'lib/groovy_oneliner/cache.rb', line 14 def []=(key, value) @cache[key] = value end |
#reset! ⇒ Object
18 19 20 |
# File 'lib/groovy_oneliner/cache.rb', line 18 def reset! @cache = {} end |