Class: Gollum::Sorters::WikiSorter

Inherits:
Object
  • Object
show all
Defined in:
lib/gollum-lib/sorters/wiki_sorter.rb

Constant Summary collapse

SORT_CREATED_AT =
"created_at".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sort, direction_desc, limit) ⇒ WikiSorter

Returns a new instance of WikiSorter.



8
9
10
11
12
# File 'lib/gollum-lib/sorters/wiki_sorter.rb', line 8

def initialize(sort, direction_desc, limit)
  @sort = sort
  @direction_desc = direction_desc
  @limit = limit
end

Instance Attribute Details

#direction_descObject (readonly)

Returns the value of attribute direction_desc.



6
7
8
# File 'lib/gollum-lib/sorters/wiki_sorter.rb', line 6

def direction_desc
  @direction_desc
end

#limitObject (readonly)

Returns the value of attribute limit.



6
7
8
# File 'lib/gollum-lib/sorters/wiki_sorter.rb', line 6

def limit
  @limit
end

#sortObject (readonly)

Returns the value of attribute sort.



6
7
8
# File 'lib/gollum-lib/sorters/wiki_sorter.rb', line 6

def sort
  @sort
end

Instance Method Details

#call(sha, access, blobs) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/gollum-lib/sorters/wiki_sorter.rb', line 14

def call(sha, access, blobs)
  if sort == SORT_CREATED_AT
    by_created_at(sha, access, blobs)
  else
    by_title(blobs)
  end
end