Module: HandySort::ClassMethods

Defined in:
lib/handy_sort.rb

Instance Method Summary collapse

Instance Method Details

#handy_sort(key, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/handy_sort.rb', line 12

def handy_sort(key, options = {})
  ranker = Ranker.new(key)

  CallbackManager.new(ranker, options).install(self)

  scope :handy_sorted, -> { order("#{key} ASC") }

  @retentioner = Retentioner.new(self, key, options[:within])
end

#retentionObject



22
23
24
# File 'lib/handy_sort.rb', line 22

def retention
  @retentioner.retention
end