fetcher_dsl 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b828ba59ecde22000359ae7de5709dde03fe7c3
4
- data.tar.gz: 646753c84a3c766ac61d3a3331b3359f9a1e84cc
3
+ metadata.gz: de8dcdd2cfb478bfa305d7c3466624070423a88a
4
+ data.tar.gz: 6d975cb73d21912a88636a01f6209ede5ef56850
5
5
  SHA512:
6
- metadata.gz: 72eb5c1b0879bb61aff39f3e2d0163ab7057491f2a096e5c304a187dc3525c2fab39fbb32b2a818399aca95dea3c9cd9a4312928e7069281411385109148714e
7
- data.tar.gz: 33e078371324003ebcb830f795f37d4a949ea0ac99c08fcbbd06cee5758272f919640606fe9d2691a9de01001ef5fcdf7b32ba8b606c4d5a033c0cc993f7ae14
6
+ metadata.gz: 380e4cea6e193eec2a2d5d066976f694ef65ceead9e480863644cc08e5a1bdf89e3fb7b0be7f5d5c80a508e9a82a6e299ce1254a7c258f0d3a88ec2ce14697b6
7
+ data.tar.gz: 836d315fa2450d411fd609483c3436da2486d6850d6272e9cb459b79e15a531bab5af9a8e044d9f56c60368f9f3d71d82c9593c8cd7c182d9edd46bcc40a63db
@@ -6,6 +6,7 @@ module FetcherDsl
6
6
 
7
7
  def initialize(&block)
8
8
  @publisher = Redis.new(host:"redis")
9
+ @period=0
9
10
  instance_eval(&block)
10
11
  end
11
12
 
@@ -23,7 +24,7 @@ module FetcherDsl
23
24
  end
24
25
 
25
26
  def publish(keys,value)
26
- @publisher.publish ["fetcher",@name,keys].flatten.join("_").downcase, value
27
+ @publisher.publish channel_name(keys), value
27
28
  end
28
29
 
29
30
  def delay(value)
@@ -37,5 +38,13 @@ module FetcherDsl
37
38
  sleep(@period)
38
39
  }
39
40
  end
41
+
42
+ private
43
+ def channel_name(keys)
44
+ unless keys.kind_of?(Array)
45
+ keys=keys.scan(/.{3}/) if keys.length==6
46
+ end
47
+ ["fetcher",@name,keys].flatten.join("_").downcase
48
+ end
40
49
  end
41
50
  end
@@ -1,3 +1,3 @@
1
1
  module FetcherDsl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetcher_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiri Kubicek