module ContextFilters::Filters::Store

Store filters

Public Instance Methods

empty?() click to toggle source

@return [Boolean] true if there are any rules stored, false otherwise

# File lib/context-filters/filters/store.rb, line 37
def empty?
  filters_store.empty?
end
filters() click to toggle source

Array of already defined filters

# File lib/context-filters/filters/store.rb, line 32
def filters
  filters_store.keys
end
filters_store() click to toggle source

@return [Hash] the filters storage @api private

# File lib/context-filters/filters/store.rb, line 17
def filters_store
  @filters_store ||= {}
end
store(options = nil, &block) click to toggle source

stores the block for given options, if the options have a block already the new one is added to the list @param options [Object] options for filtering blocks @param block [Proc] block of code to add to the list of blocks

for this options
# File lib/context-filters/filters/store.rb, line 26
def store(options = nil, &block)
  filters_store[options] ||= []
  filters_store[options] << block
end