Class: Filterameter::FilterFactory
- Inherits:
-
Object
- Object
- Filterameter::FilterFactory
- Defined in:
- lib/filterameter/filter_factory.rb
Overview
# Filter Factory
Class FilterFactory builds a filter from a FilterDeclaration.
Instance Method Summary collapse
- #build(declaration) ⇒ Object
-
#initialize(model_class) ⇒ FilterFactory
constructor
A new instance of FilterFactory.
Constructor Details
#initialize(model_class) ⇒ FilterFactory
Returns a new instance of FilterFactory.
8 9 10 |
# File 'lib/filterameter/filter_factory.rb', line 8 def initialize(model_class) @model_class = model_class end |
Instance Method Details
#build(declaration) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/filterameter/filter_factory.rb', line 12 def build(declaration) context = Helpers::DeclarationWithModel.new(@model_class, declaration) if declaration.nested? build_nested_filter(declaration, context) else build_filter(@model_class, declaration, context.scope?) end end |