Class: SimpleDrilldown::Controller::ScopeHolder
- Inherits:
-
Object
- Object
- SimpleDrilldown::Controller::ScopeHolder
- Defined in:
- lib/simple_drilldown/controller.rb
Instance Method Summary collapse
-
#initialize(scope) ⇒ ScopeHolder
constructor
A new instance of ScopeHolder.
- #order(order) ⇒ Object
- #to_s ⇒ Object
- #where(*_conditions) ⇒ Object
Constructor Details
#initialize(scope) ⇒ ScopeHolder
Returns a new instance of ScopeHolder.
604 605 606 |
# File 'lib/simple_drilldown/controller.rb', line 604 def initialize(scope) instance_eval(&scope) end |
Instance Method Details
#order(order) ⇒ Object
608 609 610 611 |
# File 'lib/simple_drilldown/controller.rb', line 608 def order(order) @order = order self end |
#to_s ⇒ Object
617 618 619 620 621 622 623 |
# File 'lib/simple_drilldown/controller.rb', line 617 def to_s if @order.is_a?(Hash) @order.map { |field, direction| "#{field} #{direction}" }.join(', ') else @order.to_s end end |
#where(*_conditions) ⇒ Object
613 614 615 |
# File 'lib/simple_drilldown/controller.rb', line 613 def where(*_conditions) self end |