Class: Jsonapi::QueryBuilder::BaseSort
- Inherits:
-
Object
- Object
- Jsonapi::QueryBuilder::BaseSort
- Defined in:
- lib/jsonapi/query_builder/base_sort.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
Instance Method Summary collapse
-
#initialize(collection, direction = :asc) ⇒ BaseSort
constructor
A new instance of BaseSort.
-
#results ⇒ ActiveRecord::Relation
Collection with order applied.
Constructor Details
#initialize(collection, direction = :asc) ⇒ BaseSort
Returns a new instance of BaseSort.
10 11 12 13 |
# File 'lib/jsonapi/query_builder/base_sort.rb', line 10 def initialize(collection, direction = :asc) @collection = collection @direction = direction end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
6 7 8 |
# File 'lib/jsonapi/query_builder/base_sort.rb', line 6 def collection @collection end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
6 7 8 |
# File 'lib/jsonapi/query_builder/base_sort.rb', line 6 def direction @direction end |
Instance Method Details
#results ⇒ ActiveRecord::Relation
Returns Collection with order applied.
16 17 18 |
# File 'lib/jsonapi/query_builder/base_sort.rb', line 16 def results raise NotImplementedError, "#{self.class} should implement #results" end |