Class: Veneer::Conditional::Order
- Inherits:
-
Object
- Object
- Veneer::Conditional::Order
- Defined in:
- lib/veneer/base/conditional.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #ascending? ⇒ Boolean
- #decending? ⇒ Boolean
-
#initialize(field, direction = :desc) ⇒ Order
constructor
A new instance of Order.
Constructor Details
#initialize(field, direction = :desc) ⇒ Order
Returns a new instance of Order.
46 47 48 49 |
# File 'lib/veneer/base/conditional.rb', line 46 def initialize(field, direction = :desc) @field = field.to_sym @direction = direction.to_sym end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
45 46 47 |
# File 'lib/veneer/base/conditional.rb', line 45 def direction @direction end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
45 46 47 |
# File 'lib/veneer/base/conditional.rb', line 45 def field @field end |
Instance Method Details
#==(other) ⇒ Object
59 60 61 62 63 |
# File 'lib/veneer/base/conditional.rb', line 59 def ==(other) self.class == other.class && field == other.field && direction == other.direction end |
#ascending? ⇒ Boolean
51 52 53 |
# File 'lib/veneer/base/conditional.rb', line 51 def ascending? direction == :asc end |
#decending? ⇒ Boolean
55 56 57 |
# File 'lib/veneer/base/conditional.rb', line 55 def decending? !ascending? end |