simplepubsub 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af89b996482dc325fdd85c469c2441ebce8ba448
4
- data.tar.gz: 72a23fd01a6d6ebc0b5921db62c4a3cef678c877
3
+ metadata.gz: 1805609c5dec321fbde1b6c835a93edef5448009
4
+ data.tar.gz: e8b0604afbb9096bf109d34c65917360730a4801
5
5
  SHA512:
6
- metadata.gz: 1b528947e8cf4f713ab9c75995c175a63591188fb4068fb99fbd63c8bb15bfe03b4b52e16f01f1793de127196559d3972e811654ecce14517dc14b32758753bb
7
- data.tar.gz: aba169af00666f7d226f44138f6f69ea0f473edf6bc27715530dea7b3c90a6a788fd0b045b63440dc07162375d85ecff548bd268affa38ce66e13546a7c7a351
6
+ metadata.gz: 70c9367e4e48284bb71e68d0dfd1ec45b7947973a00978f4d06c7096cc2759ceccfdf3c9881317d1858fe8d7f60f042874eae9c82888c1c245391b72994c3fc6
7
+ data.tar.gz: 610a2d6be70cc96c9ab3d07b34729874d5bfba5b18b1781d72f3742c6dad9be0e1e0f659f4c40153fd5c529c4600100e48d58b1d7d436191d3ebd755445cf480
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/simplepubsub.rb CHANGED
@@ -6,6 +6,7 @@ require 'open-uri'
6
6
  require 'drb'
7
7
  require 'dws-registry'
8
8
  require 'socket'
9
+ require 'chronic_duration'
9
10
 
10
11
 
11
12
  USER_AGENT = 'SimplePbSub client 0.5'
@@ -17,11 +18,17 @@ module SimplePubSub
17
18
 
18
19
  class Echo
19
20
 
20
- def initialize(&get_proc)
21
+ def initialize(options, &get_proc)
22
+
23
+ @interval = options[:interval]
24
+ @t1 = Time.now
21
25
  @get_proc = get_proc
22
26
  end
23
27
 
24
28
  def message(topic, message)
29
+
30
+ return if @interval and @t1 + ChronicDuration.parse(@interval) > Time.now
31
+ @t1 = Time.now
25
32
  @get_proc.call topic, message
26
33
  end
27
34
  end
@@ -30,9 +37,9 @@ module SimplePubSub
30
37
  @hostname = hostname
31
38
  end
32
39
 
33
- def get(topic, &get_proc)
40
+ def get(topic, options={}, &get_proc)
34
41
 
35
- DRb.start_service nil, Echo.new(&get_proc)
42
+ DRb.start_service nil, Echo.new(options, &get_proc)
36
43
 
37
44
  obj = DRbObject.new nil, "druby://#{@hostname}:59000"
38
45
  obj.subscribe(topic, DRb.uri)
@@ -255,4 +262,4 @@ module SimplePubSub
255
262
 
256
263
  end
257
264
 
258
- end
265
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplepubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,34 +31,34 @@ cert_chain:
31
31
  i0PBE6fLwlIMk8jNNUcX3J1csSMgLNTwE8CwrlSZE8sueHj0pQzICM7lF0gGREO6
32
32
  hQHD0LljU3MusQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2013-08-28 00:00:00.000000000 Z
34
+ date: 2013-10-30 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dws-registry
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: chronic_duration
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  description:
@@ -78,12 +78,12 @@ require_paths:
78
78
  - lib
79
79
  required_ruby_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
metadata.gz.sig CHANGED
Binary file