Class: MaybeLater::Store
- Inherits:
-
Object
- Object
- MaybeLater::Store
- Defined in:
- lib/maybe_later/store.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
Class Method Summary collapse
Instance Method Summary collapse
- #add_callback(callable) ⇒ Object
- #any_callbacks? ⇒ Boolean
- #clear_callbacks! ⇒ Object
-
#initialize ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize ⇒ Store
Returns a new instance of Store.
8 9 10 |
# File 'lib/maybe_later/store.rb', line 8 def initialize @callbacks = [] end |
Instance Attribute Details
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
7 8 9 |
# File 'lib/maybe_later/store.rb', line 7 def callbacks @callbacks end |
Class Method Details
.instance ⇒ Object
3 4 5 |
# File 'lib/maybe_later/store.rb', line 3 def self.instance Thread.current[:maybe_later_store] ||= new end |
Instance Method Details
#add_callback(callable) ⇒ Object
16 17 18 |
# File 'lib/maybe_later/store.rb', line 16 def add_callback(callable) @callbacks << callable end |
#any_callbacks? ⇒ Boolean
12 13 14 |
# File 'lib/maybe_later/store.rb', line 12 def any_callbacks? !@callbacks.empty? end |
#clear_callbacks! ⇒ Object
20 21 22 |
# File 'lib/maybe_later/store.rb', line 20 def clear_callbacks! @callbacks = [] end |