Class: Reacto::Cache::Memory
- Inherits:
-
Object
- Object
- Reacto::Cache::Memory
- Defined in:
- lib/reacto/cache/memory.rb
Instance Method Summary collapse
- #closed? ⇒ Boolean
- #each ⇒ Object
- #error ⇒ Object
- #error? ⇒ Boolean
-
#initialize(_ = nil) ⇒ Memory
constructor
A new instance of Memory.
- #on_close ⇒ Object
- #on_error(error) ⇒ Object
- #on_value(value) ⇒ Object
- #ready? ⇒ Boolean
Constructor Details
#initialize(_ = nil) ⇒ Memory
Returns a new instance of Memory.
4 5 6 7 |
# File 'lib/reacto/cache/memory.rb', line 4 def initialize(_ = nil) @values = [] @closed = false end |
Instance Method Details
#closed? ⇒ Boolean
23 24 25 |
# File 'lib/reacto/cache/memory.rb', line 23 def closed? @closed end |
#each ⇒ Object
9 10 11 12 13 |
# File 'lib/reacto/cache/memory.rb', line 9 def each @values.each do |value| yield value end end |
#error ⇒ Object
27 28 29 |
# File 'lib/reacto/cache/memory.rb', line 27 def error @error end |
#error? ⇒ Boolean
19 20 21 |
# File 'lib/reacto/cache/memory.rb', line 19 def error? @error != nil end |
#on_close ⇒ Object
39 40 41 |
# File 'lib/reacto/cache/memory.rb', line 39 def on_close @closed = true end |
#on_error(error) ⇒ Object
35 36 37 |
# File 'lib/reacto/cache/memory.rb', line 35 def on_error(error) @error = error end |
#on_value(value) ⇒ Object
31 32 33 |
# File 'lib/reacto/cache/memory.rb', line 31 def on_value(value) @values << value end |
#ready? ⇒ Boolean
15 16 17 |
# File 'lib/reacto/cache/memory.rb', line 15 def ready? error? || closed? end |