huck 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/huck/util.rb +2 -6
- data/lib/huck/version.rb +1 -1
- data/lib/huck.rb +3 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2237c30b01d9ea57decac0518ca515240983593e
|
4
|
+
data.tar.gz: fa2a2551c691f2f8ea244e076f74129e8cd0f5ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030d1d2e7af651b0e9098656e0d3342da57629ebf52b767c2b8265eabdf61d71a3ff0c1a43f46cdd9c6b8156a731a8c9d9a40bd8bc897286e4703acb102eea01
|
7
|
+
data.tar.gz: a1cae10fb99e136a8706481c14d3230a2e0c03092816308a711e98d248d06d5eb5938eef0444535022ba56b4e7e516f87c7f9c5f07e0a730f2ee3811eead9985
|
data/lib/huck/util.rb
CHANGED
@@ -64,7 +64,7 @@ module Huck
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
# Serialize
|
67
|
+
# Serialize data to a desired format.
|
68
68
|
#
|
69
69
|
# == Parameters:
|
70
70
|
# format::
|
@@ -73,12 +73,8 @@ module Huck
|
|
73
73
|
# == Returns:
|
74
74
|
# A string of serialized text
|
75
75
|
#
|
76
|
-
def self.
|
76
|
+
def self.serialize data, kwargs = {}
|
77
77
|
format = Huck::getarg kwargs, :format, 'json'
|
78
|
-
if !data.is_a? Hash
|
79
|
-
raise RuntimeError, 'cannot serialize non-hash data'
|
80
|
-
end
|
81
|
-
|
82
78
|
case format
|
83
79
|
when 'json'
|
84
80
|
return JSON.dump data
|
data/lib/huck/version.rb
CHANGED
data/lib/huck.rb
CHANGED
@@ -20,9 +20,8 @@ require 'huck/handlers/exec'
|
|
20
20
|
module Huck
|
21
21
|
|
22
22
|
# Main method to run Huck and dump info. If a block is given, the block will
|
23
|
-
# be used as the generator code.
|
24
|
-
#
|
25
|
-
# configured generator will be invoked instead.
|
23
|
+
# be used as the generator code. If no block is passed, then the configured
|
24
|
+
# generator will be invoked instead.
|
26
25
|
#
|
27
26
|
# == Parameters:
|
28
27
|
# config::
|
@@ -54,7 +53,7 @@ module Huck
|
|
54
53
|
s = Sender::factory :name => send_name, :config => config
|
55
54
|
|
56
55
|
data = block_given? ? yield : g.generate
|
57
|
-
s.send Huck::
|
56
|
+
s.send Huck::serialize data
|
58
57
|
end
|
59
58
|
|
60
59
|
# Main method to receive messages from a Huck client. If a block is given, the
|