Class: Filterable::Generator
- Inherits:
-
Object
- Object
- Filterable::Generator
- Defined in:
- lib/toschas/filterable/generator.rb
Instance Attribute Summary collapse
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#model ⇒ Object
Returns the value of attribute model.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(model, filters) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(model, filters) ⇒ Generator
Returns a new instance of Generator.
10 11 12 13 14 |
# File 'lib/toschas/filterable/generator.rb', line 10 def initialize(model, filters) @model = model @filters = filters @options = filters.last.is_a?(Hash) ? filters.pop : {} end |
Instance Attribute Details
#filters ⇒ Object
Returns the value of attribute filters.
8 9 10 |
# File 'lib/toschas/filterable/generator.rb', line 8 def filters @filters end |
#model ⇒ Object
Returns the value of attribute model.
8 9 10 |
# File 'lib/toschas/filterable/generator.rb', line 8 def model @model end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/toschas/filterable/generator.rb', line 8 def @options end |
Instance Method Details
#generate ⇒ Object
16 17 18 19 |
# File 'lib/toschas/filterable/generator.rb', line 16 def generate generate_filter unless model.respond_to? :filter generate_scopes end |