ranked-model 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Readme.mkd CHANGED
@@ -84,10 +84,11 @@ Internals
84
84
 
85
85
  This libarary is written using ARel from the ground-up. This leaves the code much cleaner
86
86
  than many implementations. ranked-model is also optimized to write to the database as little
87
- as possible: ranks are stored as a number between 0 and 65534 (just below MEDIUMINT in MySQL).
87
+ as possible: ranks are stored as a number between -8388607 and 8388607 (the MEDIUMINT range in MySQL).
88
88
  When an item is given a new position, it assigns itself a rank number between two neighbors.
89
- This allows several movements of items before no digits are available between to neighbors. When
90
- this occurs, ranked-model will rebalance the distribution of rank numbers across all memebers
89
+ This allows several movements of items before no digits are available between two neighbors. When
90
+ this occurs, ranked-model will try to shift other records out of the way. If items can't be easily
91
+ shifted anymore, it will rebalance the distribution of rank numbers across all memebers
91
92
  of the ranked group.
92
93
 
93
94
  Contributing
@@ -96,3 +97,9 @@ Contributing
96
97
  Fork, clone, write a test, write some code, commit, push, send a pull request. Github FTW!
97
98
 
98
99
  This project was open-sourced by [Harvest](http://getharvest.com/). [We're hiring!](http://www.getharvest.com/careers)
100
+
101
+ A hearty thanks to these contributors:
102
+
103
+ * [yabawock](https://github.com/yabawock)
104
+ * [AndrewRadev](https://github.com/AndrewRadev/ranked-model)
105
+
data/lib/ranked-model.rb CHANGED
@@ -47,6 +47,7 @@ module RankedModel
47
47
  ranker = RankedModel::Ranker.new(*args)
48
48
  self.rankers << ranker
49
49
  attr_accessor "#{ranker.name}_position"
50
+ public "#{ranker.name}_position", "#{ranker.name}_position="
50
51
  end
51
52
 
52
53
  end
@@ -1,3 +1,3 @@
1
1
  module RankedModel
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,5 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Duck do
4
+
5
+ before {
6
+ @duck = Duck.new
7
+ }
8
+
9
+ subject { @duck }
10
+
11
+ it { subject.respond_to?(:row_position).should be_true }
12
+ it { subject.respond_to?(:row_position=).should be_true }
13
+ it { subject.respond_to?(:size_position).should be_true }
14
+ it { subject.respond_to?(:size_position=).should be_true }
15
+ it { subject.respond_to?(:age_position).should be_true }
16
+ it { subject.respond_to?(:age_position=).should be_true }
17
+
18
+ end
19
+
3
20
  describe Duck do
4
21
 
5
22
  before {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ranked-model
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew Beale
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-14 00:00:00 -04:00
18
+ date: 2011-04-27 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  requirements: []
166
166
 
167
167
  rubyforge_project:
168
- rubygems_version: 1.5.0
168
+ rubygems_version: 1.6.2
169
169
  signing_key:
170
170
  specification_version: 3
171
171
  summary: An acts_as_sortable replacement built for Rails 3