mongo_watchable 0.1.1 → 0.1.2
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/lib/mongo_watchable/watchable.rb +1 -1
- data/lib/mongo_watchable/watcher.rb +2 -2
- data/lib/mongo_watchable.rb +23 -6
- metadata +3 -3
@@ -2,7 +2,7 @@ module MongoWatchable
|
|
2
2
|
module Watcher
|
3
3
|
def self.included(watcher)
|
4
4
|
watcher.class_eval do
|
5
|
-
MongoWatchable.watchables do |watchable|
|
5
|
+
MongoWatchable.watchables.each do |watchable|
|
6
6
|
key :"#{watchable.name.underscore}_watching_ids", Array
|
7
7
|
|
8
8
|
define_method :"#{watchable.name.underscore}_watchings" do
|
@@ -21,7 +21,7 @@ module MongoWatchable
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
MongoWatchable.
|
24
|
+
MongoWatchable.register_watcher watcher
|
25
25
|
end
|
26
26
|
|
27
27
|
def watch(watchable)
|
data/lib/mongo_watchable.rb
CHANGED
@@ -1,13 +1,30 @@
|
|
1
|
+
require 'active_support/ordered_hash'
|
1
2
|
require 'mongo_watchable/proxy'
|
2
|
-
require 'mongo_watchable/watcher'
|
3
|
-
require 'mongo_watchable/watchable'
|
4
|
-
|
5
3
|
module MongoWatchable
|
4
|
+
def self.register_watchable(watchable)
|
5
|
+
@watchables ||= ActiveSupport::OrderedHash.new
|
6
|
+
@watchables[watchable.name] = watchable
|
7
|
+
end
|
8
|
+
|
6
9
|
def self.watchables
|
7
|
-
@watchables ||=
|
10
|
+
@watchables ||= ActiveSupport::OrderedHash.new
|
11
|
+
@watchables.values
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.register_watcher(watcher)
|
15
|
+
@watchers ||= ActiveSupport::OrderedHash.new
|
16
|
+
@watchers[watcher.name] = watcher
|
8
17
|
end
|
9
18
|
|
10
19
|
def self.watchers
|
11
|
-
@watchers ||=
|
20
|
+
@watchers ||= ActiveSupport::OrderedHash.new
|
21
|
+
@watchers.values
|
12
22
|
end
|
13
|
-
|
23
|
+
|
24
|
+
autoload :Watchable, 'mongo_watchable/watchable'
|
25
|
+
autoload :Watcher, 'mongo_watchable/watcher'
|
26
|
+
end
|
27
|
+
|
28
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
29
|
+
#ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__)
|
30
|
+
#ActiveSupport::Dependencies.load_once_paths.delete(File.dirname(__FILE__))
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jonathan Bell
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-25 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|