acts_as_list_neo4j 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +21 -0
- data/README.md +74 -0
- data/VERSION +1 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 050fd8d022e4af493a0873a9aca244732f626d3c
|
4
|
+
data.tar.gz: 992d2fd686652c01d2aa10f8aa917fe840aca290
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b8e6c2ec1eb66bffab468ea3fbcaea61e9fd704c547251a5e6687e2174d14acea8ed47fa93e70f3a2ecb5a63d6305c95b7b9f907d40cdf9c1a5554b1ad6fcfc3
|
7
|
+
data.tar.gz: db41c24f202dcda6c7025e3e93c4ea577d42d241539a4b8816514af8e8663bb67975e62064ddb5d485c012133edc93857b6f40788a5c25b98f6512a42023316f
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Stayman Hou
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Neo4j Acts as list
|
2
|
+
|
3
|
+
This is a port of the classic +acts_as_list+ to Neo4j.
|
4
|
+
|
5
|
+
This *acts_as* extension provides the capabilities for sorting and reordering a number of objects in a list.
|
6
|
+
If you do not specify custom position +column+ in the options, a key named +position+ will be used automatically.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
<code>gem install acts_as_list_neo4j</code>
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
WARNING: This gem still requires refactoring. Currently, it only works OK for small workloads.
|
15
|
+
|
16
|
+
See the /specs folder specs that demontrate the API. Usage examples are located in the /examples folder.
|
17
|
+
|
18
|
+
To make a class Act as List, simply do:
|
19
|
+
|
20
|
+
<pre>
|
21
|
+
include ActsAsList::Neo4j
|
22
|
+
</pre>
|
23
|
+
|
24
|
+
And it will automatically set up a property and call acts_as_list with that property. By default the property name is :position.
|
25
|
+
You can change the defaut position_column name used: <code>ActsAsList::Neo4j.default_position_column = :pos</code>.
|
26
|
+
For this class variable to be effetive, it should be set before calling <code>include ActsAsList::Neo4j</code>.
|
27
|
+
|
28
|
+
## Example
|
29
|
+
|
30
|
+
<pre>
|
31
|
+
class Item
|
32
|
+
include Neo4j::ActiveNode
|
33
|
+
include ActsAsList::Neo4j
|
34
|
+
|
35
|
+
property :text
|
36
|
+
end
|
37
|
+
|
38
|
+
%w{'clean', 'wash', 'repair'}.each do |text|
|
39
|
+
Item.new(text: text)
|
40
|
+
end
|
41
|
+
|
42
|
+
Item.first.move(:bottom)
|
43
|
+
Item.last.move(:higher)
|
44
|
+
</pre>
|
45
|
+
|
46
|
+
## Overriding defaults
|
47
|
+
|
48
|
+
By default, when including ActsAsList::Neo4j, the property is set to :position and the acts_as_list column to :position.
|
49
|
+
To change this:
|
50
|
+
|
51
|
+
<pre>
|
52
|
+
include ActsAsList::Mongoid
|
53
|
+
|
54
|
+
property :pos, type: Integer
|
55
|
+
acts_as_list column: :pos
|
56
|
+
</pre>
|
57
|
+
|
58
|
+
## move API
|
59
|
+
|
60
|
+
<pre>
|
61
|
+
item.move(:highest) # moves to top of list.
|
62
|
+
item.move(:lowest) # moves to bottom of list.
|
63
|
+
item.move(:top) # moves to top of list.
|
64
|
+
item.move(:bottom) # moves to bottom of list.
|
65
|
+
item.move(:up) # moves one up (:higher and :up is the same) within the scope.
|
66
|
+
item.move(:down) # moves one up (:lower and :down is the same) within the scope.
|
67
|
+
item.move(to: position) # moves item to a specific position.
|
68
|
+
item.move(above: other) # moves item above the other item.*
|
69
|
+
item.move(below: other)
|
70
|
+
<pre>
|
71
|
+
|
72
|
+
## Running the specs
|
73
|
+
|
74
|
+
<code>bundle exec rspec spec</code>
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_list_neo4j
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stayman Hou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: neo4j
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cutter
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shoulda
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.32'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.32'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: jeweler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.6'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.6'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.10'
|
139
|
+
description: |-
|
140
|
+
Make your ActiveNode acts as a list. This acts_as extension provides the capabilities for sorting and reordering a number of objects in a list.
|
141
|
+
The instances that take part in the list should have a +position+ field of type Integer.
|
142
|
+
email: stayman.hou@gmail.com
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files:
|
146
|
+
- LICENSE.md
|
147
|
+
- README.md
|
148
|
+
files:
|
149
|
+
- LICENSE.md
|
150
|
+
- README.md
|
151
|
+
- VERSION
|
152
|
+
homepage: http://github.com/rails/acts_as_list
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.4.6
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: acts_as_list for ActiveNode
|
176
|
+
test_files: []
|