Module: ActiveRecordFlorder
- Defined in:
- lib/active_record_florder.rb,
lib/active_record_florder/base.rb,
lib/active_record_florder/error.rb,
lib/active_record_florder/models.rb,
lib/active_record_florder/version.rb,
lib/active_record_florder/configurable.rb
Overview
ActiveModelFlorder Floating point ActiveRecord models ordering for rich client apps heavily inspirated by Trello’s ordering alorithm. DOC: github.com/turboMaCk/active-record-florder
Defined Under Namespace
Modules: Base, Configurable, Models Classes: Error
Constant Summary collapse
- VERSION =
"0.1.0".freeze
Class Attribute Summary collapse
- .attribute ⇒ Object
- .min_delta ⇒ Object
- .return_all_affected ⇒ Object
-
.scope ⇒ Object
Returns the value of attribute scope.
- .step ⇒ Object
Class Method Summary collapse
-
.configure {|_self| ... } ⇒ Object
Configure method can be used from initializer ActiveRecordFlorder.confige do |config| config.ActiveRecordFlorder.attribute value end.
Class Attribute Details
.attribute ⇒ Object
18 19 20 |
# File 'lib/active_record_florder.rb', line 18 def attribute @attribute || :position end |
.min_delta ⇒ Object
22 23 24 |
# File 'lib/active_record_florder.rb', line 22 def min_delta @min_delta || 0.0005 end |
.return_all_affected ⇒ Object
30 31 32 |
# File 'lib/active_record_florder.rb', line 30 def return_all_affected @return_all_affected || false end |
.scope ⇒ Object
Returns the value of attribute scope.
16 17 18 |
# File 'lib/active_record_florder.rb', line 16 def scope @scope end |
.step ⇒ Object
26 27 28 |
# File 'lib/active_record_florder.rb', line 26 def step @step || 2**16 end |
Class Method Details
.configure {|_self| ... } ⇒ Object
Configure method can be used from initializer ActiveRecordFlorder.confige do |config|
config.{attribute} {value}
end
38 39 40 |
# File 'lib/active_record_florder.rb', line 38 def configure yield self if block_given? end |