ohm-contrib 2.0.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gems +2 -2
- data/lib/ohm/scope.rb +6 -17
- data/lib/ohm/softdelete.rb +1 -1
- data/ohm-contrib.gemspec +2 -2
- data/test/scope.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6d0332468e71364193f8b9101b274b3d68e0506
|
4
|
+
data.tar.gz: e9f7ed58326d36a0a1773590971d34ab4dccabae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3488b53d5c3102d660be34c4af46966e6454feea8e1c4363c05cb5c900e7900880c91d99a0ebd360cb5a4fe3d6ad37d3813c2add6165a7dca6190c3e407ae375
|
7
|
+
data.tar.gz: 829fc7c088742507391e8cbc7bca26ef3582d12f21d0ddd4553a500641c77ee0080fb610ccd83e425bf76a817de0ce91af54a7e94b860d41488632927633cff6
|
data/.gems
CHANGED
data/lib/ohm/scope.rb
CHANGED
@@ -16,32 +16,21 @@ module Ohm
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
# In Ohm v1.2, the Set
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# work anymore.
|
19
|
+
# In Ohm v1.2, the Set initialize method is defined on
|
20
|
+
# itself. Hence the trick of doing a module OverloadedSet
|
21
|
+
# with an initialize method doesn't work anymore.
|
23
22
|
#
|
24
23
|
# The simplest way to solve that as of now is to duplicate
|
25
|
-
# and extend the #initialize method for
|
24
|
+
# and extend the #initialize method for Ohm::Set.
|
26
25
|
#
|
27
26
|
# Granted it's not the _ideal_ way, the drawbacks are
|
28
27
|
# outweighed by the simplicity and performance of this
|
29
28
|
# approach versus other monkey-patching techniques.
|
30
29
|
class Set
|
31
|
-
def initialize(
|
32
|
-
@key = key
|
33
|
-
@namespace = namespace
|
30
|
+
def initialize(model, namespace, key)
|
34
31
|
@model = model
|
35
|
-
|
36
|
-
extend model::DefinedScopes if defined?(model::DefinedScopes)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class MultiSet
|
41
|
-
def initialize(namespace, model, command)
|
42
32
|
@namespace = namespace
|
43
|
-
@
|
44
|
-
@command = command
|
33
|
+
@key = key
|
45
34
|
|
46
35
|
extend model::DefinedScopes if defined?(model::DefinedScopes)
|
47
36
|
end
|
data/lib/ohm/softdelete.rb
CHANGED
data/ohm-contrib.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "ohm-contrib"
|
3
|
-
s.version = "2.0
|
3
|
+
s.version = "2.2.0"
|
4
4
|
s.summary = %{A collection of decoupled drop-in modules for Ohm.}
|
5
5
|
s.description = %{Includes a couple of core functions such as callbacks, timestamping, typecasting and lots of generic validation routines.}
|
6
6
|
s.author = "Cyril David"
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
|
13
|
-
s.add_dependency "ohm", "~> 2.
|
13
|
+
s.add_dependency "ohm", "~> 2.2"
|
14
14
|
|
15
15
|
s.add_development_dependency "cutest", "~> 1.2"
|
16
16
|
s.add_development_dependency "iconv", "~> 1.0"
|
data/test/scope.rb
CHANGED
@@ -35,7 +35,7 @@ test "allows custom methods for the defined scopes" do
|
|
35
35
|
comment = Comment.create(status: "approved")
|
36
36
|
post.comments.add(comment)
|
37
37
|
|
38
|
-
assert post.comments.approved.is_a?(Ohm::
|
38
|
+
assert post.comments.approved.is_a?(Ohm::Set)
|
39
39
|
assert post.comments.approved.include?(comment)
|
40
40
|
end
|
41
41
|
|
@@ -44,7 +44,7 @@ test "allows custom methods to be included from a module" do
|
|
44
44
|
comment = Comment.create(status: "rejected")
|
45
45
|
post.comments.add(comment)
|
46
46
|
|
47
|
-
assert post.comments.rejected.is_a?(Ohm::
|
47
|
+
assert post.comments.rejected.is_a?(Ohm::Set)
|
48
48
|
assert post.comments.rejected.include?(comment)
|
49
49
|
end
|
50
50
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohm-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril David
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ohm
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cutest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.4.5
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: A collection of decoupled drop-in modules for Ohm.
|