simplejob 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -48,7 +48,7 @@ module SimpleJob
48
48
  alias_method :orig_send, :send
49
49
  def send(topic, props = {})
50
50
  raise "Message properties should be a Hash" unless props.kind_of?(Hash)
51
- log.info "[simplejob] New job: #{topic}, #{props.inspect}"
51
+ log.info "[simplejob] New job: #{topic}, #{props.truncated_inspect}"
52
52
  publish(topic, props.to_json)
53
53
  end
54
54
 
@@ -0,0 +1,15 @@
1
+ class Hash
2
+
3
+ def truncated_inspect(length = 256)
4
+ values = self.collect do |key, value|
5
+ "#{key.inspect} => #{truncated_value(value, length)}"
6
+ end
7
+ "{#{values.join(', ')}}"
8
+ end
9
+
10
+ private
11
+
12
+ def truncated_value(value, length)
13
+ value.is_a?(String) && value.length > length ? (value[0 .. length - 3] + "...").inspect : value.inspect
14
+ end
15
+ end
@@ -44,7 +44,7 @@ module SimpleJob
44
44
 
45
45
  props = JSON.parse(body).with_indifferent_access
46
46
  props[:topic] = topic
47
- log.info "[worker] Props: #{props.inspect}"
47
+ log.info "[worker] Props: #{props.truncated_inspect}"
48
48
 
49
49
  if handler = find_handler(topic)
50
50
  handler.call(props)
data/lib/simplejob.rb CHANGED
@@ -5,6 +5,7 @@ require "active_support/core_ext/hash"
5
5
 
6
6
  require "simplejob/client"
7
7
  require "simplejob/worker"
8
+ require "simplejob/hash_extensions"
8
9
 
9
10
  module SimpleJob
10
11
 
data/simplejob.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simplejob}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Ken Pratt}]
12
- s.date = %q{2011-07-11}
12
+ s.date = %q{2011-09-07}
13
13
  s.description = %q{A simple AMQP-backed job queuing system.}
14
14
  s.email = %q{ken@kenpratt.net}
15
15
  s.extra_rdoc_files = [
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
38
38
  "examples/wildcard_handlers/wiretap.rb",
39
39
  "lib/simplejob.rb",
40
40
  "lib/simplejob/client.rb",
41
+ "lib/simplejob/hash_extensions.rb",
41
42
  "lib/simplejob/worker.rb",
42
43
  "simplejob.gemspec",
43
44
  "test/helper.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplejob
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Pratt
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-11 00:00:00 Z
18
+ date: 2011-09-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
@@ -96,6 +96,7 @@ files:
96
96
  - examples/wildcard_handlers/wiretap.rb
97
97
  - lib/simplejob.rb
98
98
  - lib/simplejob/client.rb
99
+ - lib/simplejob/hash_extensions.rb
99
100
  - lib/simplejob/worker.rb
100
101
  - simplejob.gemspec
101
102
  - test/helper.rb