decentworks-date-support 0.1.0 → 0.2.0

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.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +89 -3
  3. data/LICENSE +1 -1
  4. data/README.md +268 -24
  5. data/lib/decentworks/date_support/configuration.rb +73 -0
  6. data/lib/decentworks/date_support/date.rb +9 -0
  7. data/lib/decentworks/date_support/date_extension.rb +761 -0
  8. data/lib/decentworks/date_support/date_time.rb +9 -0
  9. data/lib/decentworks/date_support/time.rb +7 -0
  10. data/lib/decentworks/date_support/time_extension.rb +742 -0
  11. data/lib/decentworks/date_support/time_with_zone.rb +12 -0
  12. data/lib/decentworks/date_support/version.rb +7 -0
  13. data/lib/decentworks/date_support.rb +8 -321
  14. data/lib/decentworks-date-support.rb +3 -0
  15. data/lib/generators/decentworks/date_support/install/install_generator.rb +26 -0
  16. data/lib/generators/decentworks/date_support/install/templates/decentworks_date_support.rb.tt +50 -0
  17. data/sig/decentworks/date_support/configuration.rbs +25 -0
  18. data/sig/decentworks/date_support/date.rbs +4 -0
  19. data/sig/decentworks/date_support/date_extension.rbs +244 -0
  20. data/sig/decentworks/date_support/date_time.rbs +4 -0
  21. data/sig/decentworks/date_support/time.rbs +4 -0
  22. data/sig/decentworks/date_support/time_extension.rbs +248 -0
  23. data/sig/decentworks/date_support/time_with_zone.rbs +21 -0
  24. data/sig/decentworks/date_support/version.rbs +5 -0
  25. metadata +27 -143
  26. data/.gem_rbs_collection/actionpack/7.2/.rbs_meta.yaml +0 -9
  27. data/.gem_rbs_collection/actionpack/7.2/actioncontroller-7.2.rbs +0 -14
  28. data/.gem_rbs_collection/actionpack/7.2/actioncontroller.rbs +0 -290
  29. data/.gem_rbs_collection/actionpack/7.2/actiondispatch.rbs +0 -349
  30. data/.gem_rbs_collection/actionpack/7.2/actionpack-generated.rbs +0 -11497
  31. data/.gem_rbs_collection/actionpack/7.2/patch.rbs +0 -77
  32. data/.gem_rbs_collection/actionview/6.0/.rbs_meta.yaml +0 -9
  33. data/.gem_rbs_collection/actionview/6.0/actionview-generated.rbs +0 -8976
  34. data/.gem_rbs_collection/actionview/6.0/actionview.rbs +0 -1940
  35. data/.gem_rbs_collection/actionview/6.0/patch.rbs +0 -57
  36. data/.gem_rbs_collection/activesupport/7.0/.rbs_meta.yaml +0 -9
  37. data/.gem_rbs_collection/activesupport/7.0/activesupport-7.0.rbs +0 -381
  38. data/.gem_rbs_collection/activesupport/7.0/activesupport-generated.rbs +0 -11633
  39. data/.gem_rbs_collection/activesupport/7.0/activesupport.rbs +0 -724
  40. data/.gem_rbs_collection/activesupport/7.0/manifest.yaml +0 -15
  41. data/.gem_rbs_collection/activesupport/7.0/patch.rbs +0 -55
  42. data/.gem_rbs_collection/ast/2.4/.rbs_meta.yaml +0 -9
  43. data/.gem_rbs_collection/ast/2.4/ast.rbs +0 -73
  44. data/.gem_rbs_collection/cgi/0.5/.rbs_meta.yaml +0 -9
  45. data/.gem_rbs_collection/cgi/0.5/core.rbs +0 -925
  46. data/.gem_rbs_collection/cgi/0.5/manifest.yaml +0 -3
  47. data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +0 -9
  48. data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +0 -4
  49. data/.gem_rbs_collection/concurrent-ruby/1.1/atomic_reference.rbs +0 -16
  50. data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +0 -96
  51. data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +0 -4
  52. data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +0 -68
  53. data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +0 -249
  54. data/.gem_rbs_collection/concurrent-ruby/1.1/set.rbs +0 -4
  55. data/.gem_rbs_collection/concurrent-ruby/1.1/timer_task.rbs +0 -47
  56. data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +0 -5
  57. data/.gem_rbs_collection/connection_pool/2.4/.rbs_meta.yaml +0 -9
  58. data/.gem_rbs_collection/connection_pool/2.4/connection_pool.rbs +0 -34
  59. data/.gem_rbs_collection/connection_pool/2.4/manifest.yaml +0 -2
  60. data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +0 -9
  61. data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +0 -11
  62. data/.gem_rbs_collection/faker/3.4.2/.rbs_meta.yaml +0 -9
  63. data/.gem_rbs_collection/faker/3.4.2/faker-2.23.rbs +0 -90
  64. data/.gem_rbs_collection/faker/3.4.2/faker.rbs +0 -18
  65. data/.gem_rbs_collection/i18n/1.10/.rbs_meta.yaml +0 -9
  66. data/.gem_rbs_collection/i18n/1.10/backend.rbs +0 -274
  67. data/.gem_rbs_collection/i18n/1.10/i18n.rbs +0 -116
  68. data/.gem_rbs_collection/lint_roller/1.1/.rbs_meta.yaml +0 -9
  69. data/.gem_rbs_collection/lint_roller/1.1/lint_roller.rbs +0 -48
  70. data/.gem_rbs_collection/minitest/5.25/.rbs_meta.yaml +0 -9
  71. data/.gem_rbs_collection/minitest/5.25/minitest/abstract_reporter.rbs +0 -52
  72. data/.gem_rbs_collection/minitest/5.25/minitest/assertion.rbs +0 -17
  73. data/.gem_rbs_collection/minitest/5.25/minitest/assertions.rbs +0 -590
  74. data/.gem_rbs_collection/minitest/5.25/minitest/backtrace_filter.rbs +0 -23
  75. data/.gem_rbs_collection/minitest/5.25/minitest/bench_spec.rbs +0 -102
  76. data/.gem_rbs_collection/minitest/5.25/minitest/benchmark.rbs +0 -259
  77. data/.gem_rbs_collection/minitest/5.25/minitest/composite_reporter.rbs +0 -25
  78. data/.gem_rbs_collection/minitest/5.25/minitest/compress.rbs +0 -13
  79. data/.gem_rbs_collection/minitest/5.25/minitest/error_on_warning.rbs +0 -3
  80. data/.gem_rbs_collection/minitest/5.25/minitest/expectation.rbs +0 -2
  81. data/.gem_rbs_collection/minitest/5.25/minitest/expectations.rbs +0 -21
  82. data/.gem_rbs_collection/minitest/5.25/minitest/guard.rbs +0 -64
  83. data/.gem_rbs_collection/minitest/5.25/minitest/mock.rbs +0 -64
  84. data/.gem_rbs_collection/minitest/5.25/minitest/parallel/executor.rbs +0 -46
  85. data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test/class_methods.rbs +0 -5
  86. data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test.rbs +0 -3
  87. data/.gem_rbs_collection/minitest/5.25/minitest/parallel.rbs +0 -2
  88. data/.gem_rbs_collection/minitest/5.25/minitest/pride_io.rbs +0 -62
  89. data/.gem_rbs_collection/minitest/5.25/minitest/pride_lol.rbs +0 -19
  90. data/.gem_rbs_collection/minitest/5.25/minitest/progress_reporter.rbs +0 -11
  91. data/.gem_rbs_collection/minitest/5.25/minitest/reportable.rbs +0 -53
  92. data/.gem_rbs_collection/minitest/5.25/minitest/reporter.rbs +0 -5
  93. data/.gem_rbs_collection/minitest/5.25/minitest/result.rbs +0 -28
  94. data/.gem_rbs_collection/minitest/5.25/minitest/runnable.rbs +0 -163
  95. data/.gem_rbs_collection/minitest/5.25/minitest/skip.rbs +0 -6
  96. data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl/instance_methods.rbs +0 -48
  97. data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl.rbs +0 -129
  98. data/.gem_rbs_collection/minitest/5.25/minitest/spec.rbs +0 -11
  99. data/.gem_rbs_collection/minitest/5.25/minitest/statistics_reporter.rbs +0 -81
  100. data/.gem_rbs_collection/minitest/5.25/minitest/summary_reporter.rbs +0 -18
  101. data/.gem_rbs_collection/minitest/5.25/minitest/test/lifecycle_hooks.rbs +0 -92
  102. data/.gem_rbs_collection/minitest/5.25/minitest/test.rbs +0 -69
  103. data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_error.rbs +0 -12
  104. data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_warning.rbs +0 -6
  105. data/.gem_rbs_collection/minitest/5.25/minitest/unit/test_case.rbs +0 -3
  106. data/.gem_rbs_collection/minitest/5.25/minitest/unit.rbs +0 -4
  107. data/.gem_rbs_collection/minitest/5.25/minitest.rbs +0 -115
  108. data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +0 -9
  109. data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +0 -2332
  110. data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +0 -4
  111. data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +0 -9
  112. data/.gem_rbs_collection/parallel/1.20/parallel.rbs +0 -86
  113. data/.gem_rbs_collection/parser/3.2/.rbs_meta.yaml +0 -9
  114. data/.gem_rbs_collection/parser/3.2/manifest.yaml +0 -7
  115. data/.gem_rbs_collection/parser/3.2/parser.rbs +0 -194
  116. data/.gem_rbs_collection/parser/3.2/polyfill.rbs +0 -4
  117. data/.gem_rbs_collection/rack/2.2/.rbs_meta.yaml +0 -9
  118. data/.gem_rbs_collection/rack/2.2/manifest.yaml +0 -3
  119. data/.gem_rbs_collection/rack/2.2/rack.rbs +0 -1480
  120. data/.gem_rbs_collection/rails-dom-testing/2.0/.rbs_meta.yaml +0 -9
  121. data/.gem_rbs_collection/rails-dom-testing/2.0/rails-dom-testing.rbs +0 -51
  122. data/.gem_rbs_collection/rails-html-sanitizer/1.6/.rbs_meta.yaml +0 -9
  123. data/.gem_rbs_collection/rails-html-sanitizer/1.6/rails-html-sanitizer.rbs +0 -53
  124. data/.gem_rbs_collection/railties/6.0/.rbs_meta.yaml +0 -9
  125. data/.gem_rbs_collection/railties/6.0/manifest.yaml +0 -2
  126. data/.gem_rbs_collection/railties/6.0/patch.rbs +0 -17
  127. data/.gem_rbs_collection/railties/6.0/railties-generated.rbs +0 -4822
  128. data/.gem_rbs_collection/railties/6.0/railties.rbs +0 -44
  129. data/.gem_rbs_collection/rainbow/3.0/.rbs_meta.yaml +0 -9
  130. data/.gem_rbs_collection/rainbow/3.0/global.rbs +0 -7
  131. data/.gem_rbs_collection/rainbow/3.0/presenter.rbs +0 -209
  132. data/.gem_rbs_collection/rainbow/3.0/rainbow.rbs +0 -5
  133. data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +0 -9
  134. data/.gem_rbs_collection/rake/13.0/manifest.yaml +0 -2
  135. data/.gem_rbs_collection/rake/13.0/rake.rbs +0 -39
  136. data/.gem_rbs_collection/regexp_parser/2.8/.rbs_meta.yaml +0 -9
  137. data/.gem_rbs_collection/regexp_parser/2.8/regexp_parser.rbs +0 -17
  138. data/.gem_rbs_collection/rubocop/1.57/.rbs_meta.yaml +0 -9
  139. data/.gem_rbs_collection/rubocop/1.57/rubocop.rbs +0 -208
  140. data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +0 -9
  141. data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +0 -903
  142. data/.gem_rbs_collection/thor/1.2/.rbs_meta.yaml +0 -9
  143. data/.gem_rbs_collection/thor/1.2/thor.rbs +0 -62
  144. data/.gem_rbs_collection/tzinfo/2.0/.rbs_meta.yaml +0 -9
  145. data/.gem_rbs_collection/tzinfo/2.0/manifest.yaml +0 -7
  146. data/.gem_rbs_collection/tzinfo/2.0/tzinfo.rbs +0 -600
  147. data/.rspec +0 -3
  148. data/.rubocop.yml +0 -8
  149. data/.ruby-version +0 -1
  150. data/CODE_OF_CONDUCT.md +0 -132
  151. data/LICENSE.txt +0 -21
  152. data/Rakefile +0 -12
  153. data/Steepfile +0 -43
  154. data/lib/decentworks/active_support/time_with_zone_support.rb +0 -327
  155. data/lib/decentworks/date/support/version.rb +0 -9
  156. data/lib/decentworks_date_support.rb +0 -4
  157. data/rbs_collection.lock.yaml +0 -288
  158. data/rbs_collection.yaml +0 -41
  159. data/sig/decentworks/active_support/time_with_zone_support.rbs +0 -109
  160. data/sig/decentworks/date/support.rbs +0 -8
  161. data/sig/decentworks/date_support.rbs +0 -107
@@ -1,349 +0,0 @@
1
- module ActionDispatch
2
- class Cookies
3
- class CookieJar
4
- def fetch: (untyped name, *untyped args) ?{ () -> untyped } -> untyped
5
- end
6
- end
7
- end
8
-
9
- module ActionDispatch
10
- module Http
11
- class Headers
12
- # Returns the value for the given key mapped to @env.
13
- #
14
- # If the key is not found and an optional code block is not provided,
15
- # raises a <tt>KeyError</tt> exception.
16
- #
17
- # If the code block is provided, then it will be run and
18
- # its result returned.
19
- def fetch: (untyped key) ?{ () -> untyped } -> untyped
20
- | (untyped key, untyped default) -> untyped
21
- end
22
- end
23
- end
24
-
25
- module ActionDispatch
26
- class Request
27
- class Session
28
- # Returns value of the given key from the session, or raises +KeyError+
29
- # if can't find the given key and no default value is set.
30
- # Returns default value if specified.
31
- #
32
- # session.fetch(:foo)
33
- # # => KeyError: key not found: "foo"
34
- #
35
- # session.fetch(:foo, :bar)
36
- # # => :bar
37
- #
38
- # session.fetch(:foo) do
39
- # :bar
40
- # end
41
- # # => :bar
42
- def fetch: (untyped key) ?{ () -> untyped } -> untyped
43
- | (untyped key, untyped default) -> untyped
44
- end
45
- end
46
- end
47
-
48
- module ActionDispatch
49
- class RequestId
50
- X_REQUEST_ID: ::String
51
-
52
- def initialize: (Rack::_Application app) -> void
53
-
54
- def call: (Rack::env env) -> Rack::response
55
-
56
- private
57
-
58
- def make_request_id: (String? request_id) -> String
59
-
60
- def internal_request_id: () -> String
61
- end
62
- end
63
-
64
- module ActionDispatch
65
- module Routing
66
- module PolymorphicRoutes
67
- def polymorphic_url: (untyped record_or_hash_or_array, ?::Hash[untyped, untyped] options) -> String
68
- def polymorphic_path: (untyped record_or_hash_or_array, ?::Hash[untyped, untyped] options) -> String
69
- end
70
-
71
- class RouteSet
72
- def draw: () { () [self: Mapper] -> untyped } -> nil
73
-
74
- def url_helpers: (?bool supports_path) -> singleton(RouteSet_AnonymousModule)
75
-
76
- module RouteSet_AnonymousModule
77
- include ActiveSupport::Concern
78
- include UrlFor
79
- # https://github.com/rails/rails/blob/v7.2.2.2/actionpack/lib/action_dispatch/routing/route_set.rb#L518
80
- end
81
- end
82
-
83
- class Mapper
84
- module HttpHelpers
85
- # Define a route that only recognizes HTTP GET.
86
- # For supported arguments, see match[rdoc-ref:Base#match]
87
- #
88
- # get 'bacon', to: 'food#bacon'
89
- def get: (*untyped args) ?{ () -> untyped } -> untyped
90
-
91
- # Define a route that only recognizes HTTP POST.
92
- # For supported arguments, see match[rdoc-ref:Base#match]
93
- #
94
- # post 'bacon', to: 'food#bacon'
95
- def post: (*untyped args) ?{ () -> untyped } -> untyped
96
-
97
- # Define a route that only recognizes HTTP PATCH.
98
- # For supported arguments, see match[rdoc-ref:Base#match]
99
- #
100
- # patch 'bacon', to: 'food#bacon'
101
- def patch: (*untyped args) ?{ () -> untyped } -> untyped
102
-
103
- # Define a route that only recognizes HTTP PUT.
104
- # For supported arguments, see match[rdoc-ref:Base#match]
105
- #
106
- # put 'bacon', to: 'food#bacon'
107
- def put: (*untyped args) ?{ () -> untyped } -> untyped
108
-
109
- # Define a route that only recognizes HTTP DELETE.
110
- # For supported arguments, see match[rdoc-ref:Base#match]
111
- #
112
- # delete 'broccoli', to: 'food#broccoli'
113
- def delete: (*untyped args) ?{ () -> untyped } -> untyped
114
-
115
- private
116
-
117
- def map_method: (untyped method, untyped args) ?{ () -> untyped } -> untyped
118
- end
119
-
120
- module Resources
121
- # Sometimes, you have a resource that clients always look up without
122
- # referencing an ID. A common example, /profile always shows the
123
- # profile of the currently logged in user. In this case, you can use
124
- # a singular resource to map /profile (rather than /profile/:id) to
125
- # the show action:
126
- #
127
- # resource :profile
128
- #
129
- # This creates six different routes in your application, all mapping to
130
- # the +Profiles+ controller (note that the controller is named after
131
- # the plural):
132
- #
133
- # GET /profile/new
134
- # GET /profile
135
- # GET /profile/edit
136
- # PATCH/PUT /profile
137
- # DELETE /profile
138
- # POST /profile
139
- #
140
- # === Options
141
- # Takes same options as resources[rdoc-ref:#resources]
142
- def resource: (*untyped resources) ?{ () -> untyped } -> untyped
143
-
144
- # In Rails, a resourceful route provides a mapping between HTTP verbs
145
- # and URLs and controller actions. By convention, each action also maps
146
- # to particular CRUD operations in a database. A single entry in the
147
- # routing file, such as
148
- #
149
- # resources :photos
150
- #
151
- # creates seven different routes in your application, all mapping to
152
- # the +Photos+ controller:
153
- #
154
- # GET /photos
155
- # GET /photos/new
156
- # POST /photos
157
- # GET /photos/:id
158
- # GET /photos/:id/edit
159
- # PATCH/PUT /photos/:id
160
- # DELETE /photos/:id
161
- #
162
- # Resources can also be nested infinitely by using this block syntax:
163
- #
164
- # resources :photos do
165
- # resources :comments
166
- # end
167
- #
168
- # This generates the following comments routes:
169
- #
170
- # GET /photos/:photo_id/comments
171
- # GET /photos/:photo_id/comments/new
172
- # POST /photos/:photo_id/comments
173
- # GET /photos/:photo_id/comments/:id
174
- # GET /photos/:photo_id/comments/:id/edit
175
- # PATCH/PUT /photos/:photo_id/comments/:id
176
- # DELETE /photos/:photo_id/comments/:id
177
- #
178
- # === Options
179
- # Takes same options as match[rdoc-ref:Base#match] as well as:
180
- #
181
- # [:path_names]
182
- # Allows you to change the segment component of the +edit+ and +new+ actions.
183
- # Actions not specified are not changed.
184
- #
185
- # resources :posts, path_names: { new: "brand_new" }
186
- #
187
- # The above example will now change /posts/new to /posts/brand_new.
188
- #
189
- # [:path]
190
- # Allows you to change the path prefix for the resource.
191
- #
192
- # resources :posts, path: 'postings'
193
- #
194
- # The resource and all segments will now route to /postings instead of /posts.
195
- #
196
- # [:only]
197
- # Only generate routes for the given actions.
198
- #
199
- # resources :cows, only: :show
200
- # resources :cows, only: [:show, :index]
201
- #
202
- # [:except]
203
- # Generate all routes except for the given actions.
204
- #
205
- # resources :cows, except: :show
206
- # resources :cows, except: [:show, :index]
207
- #
208
- # [:shallow]
209
- # Generates shallow routes for nested resource(s). When placed on a parent resource,
210
- # generates shallow routes for all nested resources.
211
- #
212
- # resources :posts, shallow: true do
213
- # resources :comments
214
- # end
215
- #
216
- # Is the same as:
217
- #
218
- # resources :posts do
219
- # resources :comments, except: [:show, :edit, :update, :destroy]
220
- # end
221
- # resources :comments, only: [:show, :edit, :update, :destroy]
222
- #
223
- # This allows URLs for resources that otherwise would be deeply nested such
224
- # as a comment on a blog post like <tt>/posts/a-long-permalink/comments/1234</tt>
225
- # to be shortened to just <tt>/comments/1234</tt>.
226
- #
227
- # Set <tt>shallow: false</tt> on a child resource to ignore a parent's shallow parameter.
228
- #
229
- # [:shallow_path]
230
- # Prefixes nested shallow routes with the specified path.
231
- #
232
- # scope shallow_path: "sekret" do
233
- # resources :posts do
234
- # resources :comments, shallow: true
235
- # end
236
- # end
237
- #
238
- # The +comments+ resource here will have the following routes generated for it:
239
- #
240
- # post_comments GET /posts/:post_id/comments(.:format)
241
- # post_comments POST /posts/:post_id/comments(.:format)
242
- # new_post_comment GET /posts/:post_id/comments/new(.:format)
243
- # edit_comment GET /sekret/comments/:id/edit(.:format)
244
- # comment GET /sekret/comments/:id(.:format)
245
- # comment PATCH/PUT /sekret/comments/:id(.:format)
246
- # comment DELETE /sekret/comments/:id(.:format)
247
- #
248
- # [:shallow_prefix]
249
- # Prefixes nested shallow route names with specified prefix.
250
- #
251
- # scope shallow_prefix: "sekret" do
252
- # resources :posts do
253
- # resources :comments, shallow: true
254
- # end
255
- # end
256
- #
257
- # The +comments+ resource here will have the following routes generated for it:
258
- #
259
- # post_comments GET /posts/:post_id/comments(.:format)
260
- # post_comments POST /posts/:post_id/comments(.:format)
261
- # new_post_comment GET /posts/:post_id/comments/new(.:format)
262
- # edit_sekret_comment GET /comments/:id/edit(.:format)
263
- # sekret_comment GET /comments/:id(.:format)
264
- # sekret_comment PATCH/PUT /comments/:id(.:format)
265
- # sekret_comment DELETE /comments/:id(.:format)
266
- #
267
- # [:format]
268
- # Allows you to specify the default value for optional +format+
269
- # segment or disable it by supplying +false+.
270
- #
271
- # [:param]
272
- # Allows you to override the default param name of +:id+ in the URL.
273
- #
274
- # === Examples
275
- #
276
- # # routes call <tt>Admin::PostsController</tt>
277
- # resources :posts, module: "admin"
278
- #
279
- # # resource actions are at /admin/posts.
280
- # resources :posts, path: "admin/posts"
281
- def resources: (*untyped resources) ?{ () -> untyped } -> untyped
282
- end
283
- end
284
- end
285
- end
286
-
287
- module ActionDispatch
288
- module Routing
289
- module Redirection
290
- # Redirect any path to another path:
291
- #
292
- # get "/stories" => redirect("/posts")
293
- #
294
- # This will redirect the user, while ignoring certain parts of the request, including query string, etc.
295
- # <tt>/stories</tt>, <tt>/stories?foo=bar</tt>, etc all redirect to <tt>/posts</tt>.
296
- #
297
- # You can also use interpolation in the supplied redirect argument:
298
- #
299
- # get 'docs/:article', to: redirect('/wiki/%{article}')
300
- #
301
- # Note that if you return a path without a leading slash then the URL is prefixed with the
302
- # current SCRIPT_NAME environment variable. This is typically '/' but may be different in
303
- # a mounted engine or where the application is deployed to a subdirectory of a website.
304
- #
305
- # Alternatively you can use one of the other syntaxes:
306
- #
307
- # The block version of redirect allows for the easy encapsulation of any logic associated with
308
- # the redirect in question. Either the params and request are supplied as arguments, or just
309
- # params, depending of how many arguments your block accepts. A string is required as a
310
- # return value.
311
- #
312
- # get 'jokes/:number', to: redirect { |params, request|
313
- # path = (params[:number].to_i.even? ? "wheres-the-beef" : "i-love-lamp")
314
- # "http://#{request.host_with_port}/#{path}"
315
- # }
316
- #
317
- # Note that the +do end+ syntax for the redirect block wouldn't work, as Ruby would pass
318
- # the block to +get+ instead of +redirect+. Use <tt>{ ... }</tt> instead.
319
- #
320
- # The options version of redirect allows you to supply only the parts of the URL which need
321
- # to change, it also supports interpolation of the path similar to the first example.
322
- #
323
- # get 'stores/:name', to: redirect(subdomain: 'stores', path: '/%{name}')
324
- # get 'stores/:name(*all)', to: redirect(subdomain: 'stores', path: '/%{name}%{all}')
325
- # get '/stories', to: redirect(path: '/posts')
326
- #
327
- # This will redirect the user, while changing only the specified parts of the request,
328
- # for example the +path+ option in the last example.
329
- # <tt>/stories</tt>, <tt>/stories?foo=bar</tt>, redirect to <tt>/posts</tt> and <tt>/posts?foo=bar</tt> respectively.
330
- #
331
- # Finally, an object which responds to call can be supplied to redirect, allowing you to reuse
332
- # common redirect routes. The call method must accept two arguments, params and request, and return
333
- # a string.
334
- #
335
- # get 'accounts/:name' => redirect(SubdomainRedirector.new('api'))
336
- #
337
- def redirect: (*untyped args) ?{ () -> untyped } -> (OptionRedirect | PathRedirect | Redirect)
338
- end
339
- end
340
- end
341
-
342
- module ActionDispatch
343
- module Http
344
- module MimeNegotiation
345
- class InvalidType < Mime::Type::InvalidMimeType
346
- end
347
- end
348
- end
349
- end