lib/paginated_table/page.rb in paginated_table-0.0.1 vs lib/paginated_table/page.rb in paginated_table-0.0.2
- old
+ new
@@ -1,10 +1,9 @@
module PaginatedTable
class Page
SORT_DIRECTIONS = %w(asc desc)
- DEFAULT_PER_PAGE = 10
attr_reader :number, :rows, :sort_column, :sort_direction
def self.opposite_sort_direction(sort_direction)
index = SORT_DIRECTIONS.index(sort_direction)
@@ -12,10 +11,10 @@
end
def initialize(attributes)
@number = Integer(attributes[:number] || 1)
raise ArgumentError unless @number > 0
- @rows = Integer(attributes[:rows] || DEFAULT_PER_PAGE)
+ @rows = Integer(attributes[:rows] || PaginatedTable.configuration.rows_per_page)
raise ArgumentError unless @rows > 0
@sort_column = attributes[:sort_column] || 'id'
@sort_direction = attributes[:sort_direction] || 'asc'
raise ArgumentError unless SORT_DIRECTIONS.include?(@sort_direction)
end