Module: ContextFilters::Filters::Store
- Included in:
- Filters
- Defined in:
- lib/context-filters/filters/store.rb
Overview
Store filters
Instance Method Summary collapse
-
#empty? ⇒ Boolean
True if there are any rules stored, false otherwise.
-
#filters ⇒ Object
Array of already defined filters.
-
#filters_store ⇒ Hash
private
The filters storage.
-
#store(options = nil, &block) ⇒ Object
stores the block for given options, if the options have a block already the new one is added to the list.
Instance Method Details
#empty? ⇒ Boolean
Returns true if there are any rules stored, false otherwise.
37 38 39 |
# File 'lib/context-filters/filters/store.rb', line 37 def empty? filters_store.empty? end |
#filters ⇒ Object
Array of already defined filters
32 33 34 |
# File 'lib/context-filters/filters/store.rb', line 32 def filters filters_store.keys end |
#filters_store ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the filters storage.
17 18 19 |
# File 'lib/context-filters/filters/store.rb', line 17 def filters_store @filters_store ||= {} end |
#store(options = nil, &block) ⇒ Object
stores the block for given options, if the options have a block already the new one is added to the list
26 27 28 29 |
# File 'lib/context-filters/filters/store.rb', line 26 def store( = nil, &block) filters_store[] ||= [] filters_store[] << block end |