ww 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -58,7 +58,7 @@ spec = Gem::Specification.new do |s|
58
58
  s.add_dependency('sinatra', '>=0.9.4')
59
59
  s.add_dependency('rack', '>=1.0.1')
60
60
  s.add_dependency('haml', '>=2.2.13')
61
- s.add_dependency('json', '>=1.2.0')
61
+ #s.add_dependency('json', '>=1.2.0')
62
62
  #s.required_ruby_version = '>= 1.8.2'
63
63
 
64
64
  s.files = %w(README.rdoc ChangeLog MIT-LICENSE Rakefile) +
data/lib/ww.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ww
2
- Version = '0.4.1'
2
+ Version = '0.4.2'
3
3
  autoload 'SpyEye', 'ww/spy_eye'
4
4
  autoload 'Server', 'ww/server'
5
5
  end
@@ -4,6 +4,25 @@ autoload :JSON, 'json'
4
4
  autoload :YAML, 'yaml'
5
5
 
6
6
  module Ww::Double::Spy
7
+ if defined?(ActiveSupport::JSON)
8
+ def decode_json(json_string)
9
+ ActiveSupport::JSON.decode(json_string)
10
+ end
11
+ else
12
+ unless defined?(::JSON)
13
+ begin
14
+ require 'json_pure'
15
+ rescue LoadError
16
+ require 'json'
17
+ end
18
+ end
19
+ def decode_json(json_string)
20
+ ::JSON.parse(json_string)
21
+ end
22
+ end
23
+
24
+ module_function :decode_json
25
+
7
26
  class Request < ::Rack::Request
8
27
  attr_reader :time
9
28
  @@req_parsers = []
@@ -13,11 +32,11 @@ module Ww::Double::Spy
13
32
  end
14
33
 
15
34
  regist_request_parser %r{[application|text]/json} do |body|
16
- JSON.parse(body)
35
+ ::Ww::Double::Spy.decode_json(body)
17
36
  end
18
37
 
19
38
  regist_request_parser %r{[application|text]/json} do |body|
20
- JSON.parse(body)
39
+ ::Ww::Double::Spy.decode_json(body)
21
40
  end
22
41
 
23
42
  regist_request_parser %r{[application|text]/yaml} do |body|
@@ -28,7 +28,7 @@ module Ww
28
28
  end
29
29
 
30
30
  def call(env)
31
- [200, {"Content-Type" => "text/html"}, template.render(self)]
31
+ [200, {"Content-Type" => "text/html"}, [template.render(self)]]
32
32
  end
33
33
 
34
34
  private
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - moro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-09 00:00:00 +09:00
17
+ date: 2010-08-06 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -59,20 +59,6 @@ dependencies:
59
59
  version: 2.2.13
60
60
  type: :runtime
61
61
  version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: json
64
- prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 1
71
- - 2
72
- - 0
73
- version: 1.2.0
74
- type: :runtime
75
- version_requirements: *id004
76
62
  description: Double Web, framework to build double Web server.
77
63
  email: moronatural@gmail.com
78
64
  executables: []