Class: Sortiri::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/sortiri/utils.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sort_string:, column_name:) ⇒ Utils

Returns a new instance of Utils.



7
8
9
10
11
# File 'lib/sortiri/utils.rb', line 7

def initialize(sort_string:, column_name:)
  @sort_string = sort_string
  @column_name = column_name.to_s
  @column = find_column
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



5
6
7
# File 'lib/sortiri/utils.rb', line 5

def column
  @column
end

#column_nameObject (readonly)

Returns the value of attribute column_name.



5
6
7
# File 'lib/sortiri/utils.rb', line 5

def column_name
  @column_name
end

#sort_stringObject (readonly)

Returns the value of attribute sort_string.



5
6
7
# File 'lib/sortiri/utils.rb', line 5

def sort_string
  @sort_string
end

Instance Method Details

#directionObject



13
14
15
# File 'lib/sortiri/utils.rb', line 13

def direction
  column.toggle_direction
end

#icon_classObject



17
18
19
# File 'lib/sortiri/utils.rb', line 17

def icon_class
  column.toggle_icon_class
end