Class: Filterameter::Registries::FilterRegistry
- Inherits:
-
SubRegistry
- Object
- SubRegistry
- Filterameter::Registries::FilterRegistry
- Defined in:
- lib/filterameter/registries/filter_registry.rb
Overview
# Filter Registry
Class FilterRegistry is a collection of the filters. It captures the filter declarations when classes are loaded, then uses the injected FilterFactory to build the filters on demand as they are needed.
Instance Attribute Summary collapse
-
#ranges ⇒ Object
readonly
Returns the value of attribute ranges.
Instance Method Summary collapse
- #build_declaration(name, options) ⇒ Object
- #filter_declarations ⇒ Object
-
#initialize(factory) ⇒ FilterRegistry
constructor
A new instance of FilterRegistry.
Methods inherited from SubRegistry
#add, #fetch, #parameter_names
Constructor Details
#initialize(factory) ⇒ FilterRegistry
Returns a new instance of FilterRegistry.
12 13 14 15 |
# File 'lib/filterameter/registries/filter_registry.rb', line 12 def initialize(factory) super @ranges = {} end |
Instance Attribute Details
#ranges ⇒ Object (readonly)
Returns the value of attribute ranges.
10 11 12 |
# File 'lib/filterameter/registries/filter_registry.rb', line 10 def ranges @ranges end |
Instance Method Details
#build_declaration(name, options) ⇒ Object
17 18 19 20 21 |
# File 'lib/filterameter/registries/filter_registry.rb', line 17 def build_declaration(name, ) Filterameter::FilterDeclaration.new(name, ).tap do |fd| add_declarations_for_range(fd, , name) if fd.range_enabled? end end |
#filter_declarations ⇒ Object
23 24 25 |
# File 'lib/filterameter/registries/filter_registry.rb', line 23 def filter_declarations @declarations.values end |