ocm 0.0.6 → 0.0.7

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.
@@ -57,9 +57,9 @@ module Ocm
57
57
  def update_in_list(key, item, comps)
58
58
  messages = get_list(key)
59
59
  Ocm.logger.debug "update_in_list: messages: #{messages.inspect}"
60
- messages.each_with_index do |m,i|
60
+ messages.each_with_index do |m, i|
61
61
  match = true
62
- comps.each_pair do |k,v|
62
+ comps.each_pair do |k, v|
63
63
  if m.is_a?(Hash)
64
64
  if m[k.to_s] != v
65
65
  match = false
@@ -73,7 +73,11 @@ module Ocm
73
73
  end
74
74
  end
75
75
  if match
76
- messages[i] = item
76
+ if item
77
+ messages[i] = item
78
+ else
79
+ messages.delete_at(i)
80
+ end
77
81
  put(key, messages)
78
82
  return
79
83
  end
@@ -95,6 +99,12 @@ module Ocm
95
99
  put(key, messages)
96
100
  end
97
101
 
102
+ # Warning, this is not a safe operation, be sure it is only being called once at a time
103
+ def remove_from_list(key, comps)
104
+ #id = item.is_a?(String) ? item : item.id
105
+ update_in_list(key, nil, comps)
106
+ end
107
+
98
108
  def find(clazz, id)
99
109
  get(key_for(clazz, id))
100
110
  end
data/lib/ocm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocm
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.6
4
+ version: 0.0.7
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-11-05 00:00:00.000000000 Z
12
+ date: 2012-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iron_cache