jason 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -51,7 +51,10 @@ You can add output listeners to jason so that you can run arbitrary code upon
51
51
  the generated JSON. For example, if you'd like to log all of the JSON responses
52
52
  in Rails:
53
53
 
54
- Jason.output_listeners << lambda { |json| Rails.logger.info(json) }
54
+ Jason.output_listeners << lambda do |hash|
55
+ Rails.logger.info("[Jason] Generated output:\n#{JSON.pretty_generate(hash)}")
56
+ end
57
+
55
58
 
56
59
  ## Usage with Rails ##
57
60
 
@@ -85,4 +88,4 @@ Name your view template with the extension `jason`. Everything else is the same.
85
88
 
86
89
  ## License ##
87
90
 
88
- Jason is licensed under the MIT License. See `LICENSE` for details.
91
+ Jason is licensed under the MIT License. See `LICENSE` for details.
@@ -76,7 +76,7 @@ module Jason
76
76
  json = JSON.generate(obj)
77
77
  end
78
78
 
79
- output_listeners.each { |listener| listener.call(json) }
79
+ output_listeners.each { |listener| listener.call(obj) }
80
80
 
81
81
  json
82
82
  end
@@ -124,4 +124,4 @@ require 'jason/json_eruby'
124
124
 
125
125
  if defined? ActionView::Template
126
126
  require 'jason/rails_template_handler'
127
- end
127
+ end
@@ -1,3 +1,3 @@
1
1
  module Jason
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -90,7 +90,7 @@ EOF
90
90
  assert_equal [], Jason.output_listeners
91
91
 
92
92
  listener = mock
93
- listener.expects(:call).with('{"foo":["bar"]}')
93
+ listener.expects(:call).with({"foo" => ["bar"]})
94
94
  Jason.output_listeners << listener
95
95
 
96
96
  Jason.process('{"foo":["bar"]}')
@@ -100,4 +100,4 @@ EOF
100
100
  Jason.output_format = :compact
101
101
  Jason.output_listeners = []
102
102
  end
103
- end
103
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jason
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.6.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alexander Kern
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-07 00:00:00 -07:00
13
+ date: 2011-07-22 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency