Class: Admino::Query::Builder
- Inherits:
-
Object
- Object
- Admino::Query::Builder
- Defined in:
- lib/admino/query/builder.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(context, scope) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(context, scope) ⇒ Builder
Returns a new instance of Builder.
7 8 9 10 |
# File 'lib/admino/query/builder.rb', line 7 def initialize(context, scope) @context = context @scope = scope end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object (private)
14 15 16 17 18 19 20 21 |
# File 'lib/admino/query/builder.rb', line 14 def method_missing(method, *args) context_method = "#{method}_scope" if context.respond_to?(context_method) Builder.new(context, context.send(context_method, scope, *args)) else Builder.new(context, scope.send(method, *args)) end end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/admino/query/builder.rb', line 5 def context @context end |
#scope ⇒ Object
Returns the value of attribute scope.
4 5 6 |
# File 'lib/admino/query/builder.rb', line 4 def scope @scope end |