Class: LexoRanker::Rankable
- Inherits:
-
Module
- Object
- Module
- LexoRanker::Rankable
- Defined in:
- lib/lexoranker/rankable.rb
Overview
Module for adding convenience methods to ActiveRecord or Sequel database adapters to support ranking items. See LexoRanker::RankableMethods::Base for class and instance methods added from this module.
Instance Method Summary collapse
-
#initialize(adapter = :active_record) ⇒ Object
constructor
Instance the module to be included in the class for the database adapter.
Constructor Details
#initialize(adapter = :active_record) ⇒ Object
Instance the module to be included in the class for the database adapter.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/lexoranker/rankable.rb', line 41 def initialize(adapter = :active_record) @adapter_setting = adapter @adapter = select_adapter class_eval do def self.included(klass) klass.include(LexoRanker::RankableMethods::Base) klass.include(@adapter) end end end |