ocm 0.0.4 → 0.0.5
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/Gemfile.lock +1 -1
- data/lib/ocm/iron_cache_orm.rb +16 -2
- data/lib/ocm/version.rb +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/ocm/iron_cache_orm.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
require 'iron_cache'
|
2
|
+
require 'logger'
|
2
3
|
|
3
4
|
module Ocm
|
5
|
+
|
6
|
+
@@logger = Logger.new(STDOUT)
|
7
|
+
@@logger.level = Logger::INFO
|
8
|
+
|
9
|
+
def self.logger
|
10
|
+
@@logger
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.logger=(l)
|
14
|
+
@@logger = l
|
15
|
+
end
|
16
|
+
|
4
17
|
class Orm
|
5
18
|
|
6
19
|
# initialize with a cache object from IronCache::Client, eg: iron_cache.cache("my_object_cache")
|
@@ -43,11 +56,12 @@ module Ocm
|
|
43
56
|
# first item that matches comps is replaced with item.
|
44
57
|
def update_in_list(key, item, comps)
|
45
58
|
messages = get_list(key)
|
59
|
+
Ocm.logger.debug "update_in_list: messages: #{messages.inspect}"
|
46
60
|
messages.each_with_index do |m,i|
|
47
61
|
match = true
|
48
62
|
comps.each_pair do |k,v|
|
49
63
|
if m.is_a?(Hash)
|
50
|
-
if m[k] != v
|
64
|
+
if m[k.to_s] != v
|
51
65
|
match = false
|
52
66
|
break
|
53
67
|
end
|
@@ -64,7 +78,7 @@ module Ocm
|
|
64
78
|
return
|
65
79
|
end
|
66
80
|
end
|
67
|
-
raise "No matching item found in list"
|
81
|
+
raise "No matching item found in list for #{comps.inspect}"
|
68
82
|
end
|
69
83
|
|
70
84
|
# Warning, this is not a safe operation, be sure it is only being called once at a time
|
data/lib/ocm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_cache
|