Class: Rusql::Order
- Inherits:
-
Object
- Object
- Rusql::Order
- Defined in:
- lib/rusql/order.rb
Constant Summary collapse
- TYPES =
%i( asc desc )
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, column) ⇒ Order
constructor
A new instance of Order.
- #to_s ⇒ Object
Constructor Details
#initialize(type, column) ⇒ Order
Returns a new instance of Order.
11 12 13 14 15 16 17 |
# File 'lib/rusql/order.rb', line 11 def initialize(type, column) raise Exception.new("Expected type to be one of #{}") unless TYPES.include?(type) raise TypeException.new(Column, column.class) unless column.is_a?(Column) @type = type @column = column end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
4 5 6 |
# File 'lib/rusql/order.rb', line 4 def column @column end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/rusql/order.rb', line 3 def type @type end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/rusql/order.rb', line 19 def to_s "#{self.column.to_s} #{type.to_s.upcase}" end |