Class: Hyperion::Sort

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/sort.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, order) ⇒ Sort

Returns a new instance of Sort.



6
7
8
9
# File 'lib/hyperion/sort.rb', line 6

def initialize(field, order)
  @field = field
  @order = order
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



4
5
6
# File 'lib/hyperion/sort.rb', line 4

def field
  @field
end

#orderObject (readonly)

Returns the value of attribute order.



4
5
6
# File 'lib/hyperion/sort.rb', line 4

def order
  @order
end

Instance Method Details

#ascending?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/hyperion/sort.rb', line 11

def ascending?
  order == :asc
end

#descending?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/hyperion/sort.rb', line 15

def descending?
  order == :desc
end

#to_hObject



19
20
21
22
23
24
# File 'lib/hyperion/sort.rb', line 19

def to_h
  {
    :field => field,
    :order => order
  }
end