webrick-route_servlet 1.2.2 → 1.2.3

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: ea2b3e3f91704a6122a1c5a3aa35e46c912142a3
4
- data.tar.gz: 8f6b55aecfcf2a0ba62a0f40a5a5c96e2bb2fecc
3
+ metadata.gz: 7c2d0e45223ab7246e0b5c007ee1514b7a71393f
4
+ data.tar.gz: 072f7e57ebe5c368147aba3025c37c3e41115294
5
5
  SHA512:
6
- metadata.gz: fe7b63371a13fc1a686a8aba3ac48c5d4dd6cb84bdab1a1cf3f28e0e58eabb5deea6d4bc5222ea3b37bd406d32e6a73a2a2f5db61ca17ff2efba2d05fca30bca
7
- data.tar.gz: 65167911e10308ab4bbfa05f32dfa4fda801b7725b6bf523859c77d3537bbe4208d38602b32bb03727d13e209008838ccb5910c6d5f1edf4b1834e3fe3e29e00
6
+ metadata.gz: 620636b451da25239dc01ef48f61405cbb6366642dc4e1dc376d7019d4a288c581f088304b3ccfddccaf44f7cc56fd27eff5a9b25d5817bd5f0bfd230c149e80
7
+ data.tar.gz: cacea59d5cbda6f5125c0875065cf5aae88767bcdd639919790e9f4bf3594d49f0081f8a827518090222e3c4275359fa2ad48d63a0f4bc628953bb4277d6fd15
data/README.md CHANGED
@@ -50,10 +50,11 @@ resource
50
50
 
51
51
  s.resource "/profile", ProfileServlet
52
52
 
53
- get / post / put / delete
53
+ get / post / patch / put / delete
54
54
 
55
55
  s.get "/photos", PhotoServlet
56
56
  s.post "/photos", PhotoServlet
57
+ s.patch "/photos", PhotoServlet
57
58
  s.put "/photos/123", PhotoServlet
58
59
  s.delete "/photos/123", PhotoServlet
59
60
 
@@ -34,6 +34,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
34
34
  def index(req, res)
35
35
  res.content_type = "text/html"
36
36
  res.body = "<h2>RestServlet#index</h2>\n"
37
+ res.body += "<p>action: #{req.action}</p>\n"
37
38
  res.body += "<p>params: #{req.params}</p>\n"
38
39
  res.body += "<p><a href='/'>index</a></p>\n"
39
40
  end
@@ -41,6 +42,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
41
42
  def create(req, res)
42
43
  res.content_type = "text/html"
43
44
  res.body = "<h2>RestServlet#create</h2>\n"
45
+ res.body += "<p>action: #{req.action}</p>\n"
44
46
  res.body += "<p>params: #{req.params}</p>\n"
45
47
  res.body += "<p><a href='/'>index</a></p>\n"
46
48
  end
@@ -48,6 +50,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
48
50
  def new(req, res)
49
51
  res.content_type = "text/html"
50
52
  res.body = "<h2>RestServlet#new</h2>\n"
53
+ res.body += "<p>action: #{req.action}</p>\n"
51
54
  res.body += "<p>params: #{req.params}</p>\n"
52
55
  res.body += "<p><a href='/'>index</a></p>\n"
53
56
  end
@@ -55,6 +58,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
55
58
  def edit(req, res)
56
59
  res.content_type = "text/html"
57
60
  res.body = "<h2>RestServlet#edit</h2>\n"
61
+ res.body += "<p>action: #{req.action}</p>\n"
58
62
  res.body += "<p>params: #{req.params}</p>\n"
59
63
  res.body += "<p><a href='/'>index</a></p>\n"
60
64
  end
@@ -62,6 +66,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
62
66
  def show(req, res)
63
67
  res.content_type = "text/html"
64
68
  res.body = "<h2>RestServlet#show</h2>\n"
69
+ res.body += "<p>action: #{req.action}</p>\n"
65
70
  res.body += "<p>params: #{req.params}</p>\n"
66
71
  res.body += "<p><a href='/'>index</a></p>\n"
67
72
  end
@@ -69,6 +74,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
69
74
  def update(req, res)
70
75
  res.content_type = "text/html"
71
76
  res.body = "<h2>RestServlet#update</h2>\n"
77
+ res.body += "<p>action: #{req.action}</p>\n"
72
78
  res.body += "<p>params: #{req.params}</p>\n"
73
79
  res.body += "<p><a href='/'>index</a></p>\n"
74
80
  end
@@ -76,6 +82,7 @@ class UserServlet < WEBrick::RouteServlet::ActionServlet
76
82
  def destroy(req, res)
77
83
  res.content_type = "text/html"
78
84
  res.body = "<h2>RestServlet#destroy</h2>\n"
85
+ res.body += "<p>action: #{req.action}</p>\n"
79
86
  res.body += "<p>params: #{req.params}</p>\n"
80
87
  res.body += "<p><a href='/'>index</a></p>\n"
81
88
  end
@@ -72,7 +72,7 @@ module WEBrick
72
72
  @routes.unshift([:*, _normalize_path_re("/", request_options), servlet, servlet_options, request_options])
73
73
  end
74
74
 
75
- ["get", "post", "put", "delete"].each do |method|
75
+ ["get", "post", "patch", "put", "delete"].each do |method|
76
76
  class_eval %{
77
77
  def #{method}(re, servlet, *servlet_options, **request_options)
78
78
  @routes ||= []
@@ -93,7 +93,7 @@ module WEBrick
93
93
  :update => [:put, "#{re}/:id(.:format)"],
94
94
  :delete => [:delete, "#{re}/:id(.:format)"],
95
95
  }
96
- actions = _select_rest_actions(actions, request_options)
96
+ _select_rest_actions(actions, request_options)
97
97
 
98
98
  actions.each do |action, (method, re)|
99
99
  send(method, re, servlet, *servlet_options, request_options.merge({:action => action}))
@@ -111,7 +111,7 @@ module WEBrick
111
111
  :update => [:put, "#{re}(.:format)"],
112
112
  :delete => [:delete, "#{re}(.:format)"],
113
113
  }
114
- actions = _select_rest_actions(actions, request_options)
114
+ _select_rest_actions(actions, request_options)
115
115
 
116
116
  actions.each do |action, (method, re)|
117
117
  send(method, re, servlet, *servlet_options, request_options.merge({:action => action}))
@@ -151,12 +151,11 @@ module WEBrick
151
151
  def _select_via(request_options)
152
152
  via = request_options[:via] || :*
153
153
  via = [via] unless Array===via
154
- a = via.map(&:to_sym).map(&:upcase)
154
+ via.map(&:to_sym).map(&:upcase)
155
155
  end
156
+ private :_select_via
156
157
 
157
158
  def _select_rest_actions(actions, request_options)
158
- actions
159
-
160
159
  # only
161
160
  if request_options[:only]
162
161
  only = request_options[:only]
@@ -1,5 +1,5 @@
1
1
  module WEBrick
2
2
  module RouteServlet
3
- VERSION = "1.2.2"
3
+ VERSION = "1.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webrick-route_servlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-26 00:00:00.000000000 Z
11
+ date: 2013-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.0.0
81
+ rubygems_version: 2.0.2
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: WEBrick::RouteServlet is like a Rails routes.rb. This servlet recognizes