qwrapper 0.0.3 → 0.0.4

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: 9dd93f9625eadb6c8e0e1be07c6cd8b6fbbfbca5
4
- data.tar.gz: 0ba2c2ef4ae15690166701bc369fd9c04e26ecfd
3
+ metadata.gz: c6ebf62e687b3425c7be828f4218daf27e406707
4
+ data.tar.gz: c1aa5d6892ed90516e5ca8b54269d0a4a167ea34
5
5
  SHA512:
6
- metadata.gz: 96ad304c4cf690a04e1093ef244f03c104aad2c1e5963996cab147b54938d3a7d87d708d64274a113d9a1fa900ca3d572c78a3e0bc08fb8e7619c781edf45f9a
7
- data.tar.gz: a1c75746abb0ab55c960b231f0937623464ca8f6a97f3e7665d6a19a9d85afcf212314139ea15c46f7959efb81325d744d47231d94accdcac8dbec941ca9de64
6
+ metadata.gz: bfbab0fd2a6b26eb4b6adf3b32ed2ee62c7beb9333f7f8028fa285e3817a31015d49d4dba08091b0403d62b7e0507610a7a1cdf02ed972127b1bd6dbe82a7248
7
+ data.tar.gz: a45861de45d9fea0b1d151721a2242fcdac0f1f2f1a539e49659a619a4d5c9a3ea1de62206209460aabd998839c9ee18afed0787c9e88b9e2dfc0c9c7a28ebbc
data/.gitignore CHANGED
@@ -22,4 +22,5 @@ tmp
22
22
  mkmf.log
23
23
  .ruby-*
24
24
  messages.rb
25
- worker.rb
25
+ worker.rb
26
+ test.rb
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  module Qwrapper
2
4
  class Message
3
5
 
@@ -6,12 +8,16 @@ module Qwrapper
6
8
  attr_reader :original_body, :hash
7
9
 
8
10
  def initialize(body)
9
- raise ArgumentError.new "Message body cannot be blank" if body.blank?
11
+ raise ArgumentError.new "Message body cannot be blank" if body.nil? or body.empty?
10
12
  @original_body = body
11
13
  begin
12
- @hash = eval(body.to_s) rescue JSON.parse(body.to_s)
14
+ begin
15
+ @hash = eval(body.to_s)
16
+ rescue SyntaxError => ex
17
+ @hash = JSON.parse(body.to_s)
18
+ end
13
19
  logger.info "Message evaluated: #{@hash}"
14
- rescue => ex
20
+ rescue Exception => ex
15
21
  logger.error "Message body cannot be evaluated: #{body}"
16
22
  raise ex
17
23
  end
@@ -1,3 +1,3 @@
1
1
  module Qwrapper
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qwrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nirmit Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-04 00:00:00.000000000 Z
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler