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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +89 -3
- data/LICENSE +1 -1
- data/README.md +268 -24
- data/lib/decentworks/date_support/configuration.rb +73 -0
- data/lib/decentworks/date_support/date.rb +9 -0
- data/lib/decentworks/date_support/date_extension.rb +761 -0
- data/lib/decentworks/date_support/date_time.rb +9 -0
- data/lib/decentworks/date_support/time.rb +7 -0
- data/lib/decentworks/date_support/time_extension.rb +742 -0
- data/lib/decentworks/date_support/time_with_zone.rb +12 -0
- data/lib/decentworks/date_support/version.rb +7 -0
- data/lib/decentworks/date_support.rb +8 -321
- data/lib/decentworks-date-support.rb +3 -0
- data/lib/generators/decentworks/date_support/install/install_generator.rb +26 -0
- data/lib/generators/decentworks/date_support/install/templates/decentworks_date_support.rb.tt +50 -0
- data/sig/decentworks/date_support/configuration.rbs +25 -0
- data/sig/decentworks/date_support/date.rbs +4 -0
- data/sig/decentworks/date_support/date_extension.rbs +244 -0
- data/sig/decentworks/date_support/date_time.rbs +4 -0
- data/sig/decentworks/date_support/time.rbs +4 -0
- data/sig/decentworks/date_support/time_extension.rbs +248 -0
- data/sig/decentworks/date_support/time_with_zone.rbs +21 -0
- data/sig/decentworks/date_support/version.rbs +5 -0
- metadata +27 -143
- data/.gem_rbs_collection/actionpack/7.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/actionpack/7.2/actioncontroller-7.2.rbs +0 -14
- data/.gem_rbs_collection/actionpack/7.2/actioncontroller.rbs +0 -290
- data/.gem_rbs_collection/actionpack/7.2/actiondispatch.rbs +0 -349
- data/.gem_rbs_collection/actionpack/7.2/actionpack-generated.rbs +0 -11497
- data/.gem_rbs_collection/actionpack/7.2/patch.rbs +0 -77
- data/.gem_rbs_collection/actionview/6.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/actionview/6.0/actionview-generated.rbs +0 -8976
- data/.gem_rbs_collection/actionview/6.0/actionview.rbs +0 -1940
- data/.gem_rbs_collection/actionview/6.0/patch.rbs +0 -57
- data/.gem_rbs_collection/activesupport/7.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/activesupport/7.0/activesupport-7.0.rbs +0 -381
- data/.gem_rbs_collection/activesupport/7.0/activesupport-generated.rbs +0 -11633
- data/.gem_rbs_collection/activesupport/7.0/activesupport.rbs +0 -724
- data/.gem_rbs_collection/activesupport/7.0/manifest.yaml +0 -15
- data/.gem_rbs_collection/activesupport/7.0/patch.rbs +0 -55
- data/.gem_rbs_collection/ast/2.4/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/ast/2.4/ast.rbs +0 -73
- data/.gem_rbs_collection/cgi/0.5/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/cgi/0.5/core.rbs +0 -925
- data/.gem_rbs_collection/cgi/0.5/manifest.yaml +0 -3
- data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +0 -4
- data/.gem_rbs_collection/concurrent-ruby/1.1/atomic_reference.rbs +0 -16
- data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +0 -96
- data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +0 -4
- data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +0 -68
- data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +0 -249
- data/.gem_rbs_collection/concurrent-ruby/1.1/set.rbs +0 -4
- data/.gem_rbs_collection/concurrent-ruby/1.1/timer_task.rbs +0 -47
- data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +0 -5
- data/.gem_rbs_collection/connection_pool/2.4/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/connection_pool/2.4/connection_pool.rbs +0 -34
- data/.gem_rbs_collection/connection_pool/2.4/manifest.yaml +0 -2
- data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +0 -11
- data/.gem_rbs_collection/faker/3.4.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/faker/3.4.2/faker-2.23.rbs +0 -90
- data/.gem_rbs_collection/faker/3.4.2/faker.rbs +0 -18
- data/.gem_rbs_collection/i18n/1.10/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/i18n/1.10/backend.rbs +0 -274
- data/.gem_rbs_collection/i18n/1.10/i18n.rbs +0 -116
- data/.gem_rbs_collection/lint_roller/1.1/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/lint_roller/1.1/lint_roller.rbs +0 -48
- data/.gem_rbs_collection/minitest/5.25/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/minitest/5.25/minitest/abstract_reporter.rbs +0 -52
- data/.gem_rbs_collection/minitest/5.25/minitest/assertion.rbs +0 -17
- data/.gem_rbs_collection/minitest/5.25/minitest/assertions.rbs +0 -590
- data/.gem_rbs_collection/minitest/5.25/minitest/backtrace_filter.rbs +0 -23
- data/.gem_rbs_collection/minitest/5.25/minitest/bench_spec.rbs +0 -102
- data/.gem_rbs_collection/minitest/5.25/minitest/benchmark.rbs +0 -259
- data/.gem_rbs_collection/minitest/5.25/minitest/composite_reporter.rbs +0 -25
- data/.gem_rbs_collection/minitest/5.25/minitest/compress.rbs +0 -13
- data/.gem_rbs_collection/minitest/5.25/minitest/error_on_warning.rbs +0 -3
- data/.gem_rbs_collection/minitest/5.25/minitest/expectation.rbs +0 -2
- data/.gem_rbs_collection/minitest/5.25/minitest/expectations.rbs +0 -21
- data/.gem_rbs_collection/minitest/5.25/minitest/guard.rbs +0 -64
- data/.gem_rbs_collection/minitest/5.25/minitest/mock.rbs +0 -64
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/executor.rbs +0 -46
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test/class_methods.rbs +0 -5
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel/test.rbs +0 -3
- data/.gem_rbs_collection/minitest/5.25/minitest/parallel.rbs +0 -2
- data/.gem_rbs_collection/minitest/5.25/minitest/pride_io.rbs +0 -62
- data/.gem_rbs_collection/minitest/5.25/minitest/pride_lol.rbs +0 -19
- data/.gem_rbs_collection/minitest/5.25/minitest/progress_reporter.rbs +0 -11
- data/.gem_rbs_collection/minitest/5.25/minitest/reportable.rbs +0 -53
- data/.gem_rbs_collection/minitest/5.25/minitest/reporter.rbs +0 -5
- data/.gem_rbs_collection/minitest/5.25/minitest/result.rbs +0 -28
- data/.gem_rbs_collection/minitest/5.25/minitest/runnable.rbs +0 -163
- data/.gem_rbs_collection/minitest/5.25/minitest/skip.rbs +0 -6
- data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl/instance_methods.rbs +0 -48
- data/.gem_rbs_collection/minitest/5.25/minitest/spec/dsl.rbs +0 -129
- data/.gem_rbs_collection/minitest/5.25/minitest/spec.rbs +0 -11
- data/.gem_rbs_collection/minitest/5.25/minitest/statistics_reporter.rbs +0 -81
- data/.gem_rbs_collection/minitest/5.25/minitest/summary_reporter.rbs +0 -18
- data/.gem_rbs_collection/minitest/5.25/minitest/test/lifecycle_hooks.rbs +0 -92
- data/.gem_rbs_collection/minitest/5.25/minitest/test.rbs +0 -69
- data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_error.rbs +0 -12
- data/.gem_rbs_collection/minitest/5.25/minitest/unexpected_warning.rbs +0 -6
- data/.gem_rbs_collection/minitest/5.25/minitest/unit/test_case.rbs +0 -3
- data/.gem_rbs_collection/minitest/5.25/minitest/unit.rbs +0 -4
- data/.gem_rbs_collection/minitest/5.25/minitest.rbs +0 -115
- data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +0 -2332
- data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +0 -4
- data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/parallel/1.20/parallel.rbs +0 -86
- data/.gem_rbs_collection/parser/3.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/parser/3.2/manifest.yaml +0 -7
- data/.gem_rbs_collection/parser/3.2/parser.rbs +0 -194
- data/.gem_rbs_collection/parser/3.2/polyfill.rbs +0 -4
- data/.gem_rbs_collection/rack/2.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rack/2.2/manifest.yaml +0 -3
- data/.gem_rbs_collection/rack/2.2/rack.rbs +0 -1480
- data/.gem_rbs_collection/rails-dom-testing/2.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rails-dom-testing/2.0/rails-dom-testing.rbs +0 -51
- data/.gem_rbs_collection/rails-html-sanitizer/1.6/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rails-html-sanitizer/1.6/rails-html-sanitizer.rbs +0 -53
- data/.gem_rbs_collection/railties/6.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/railties/6.0/manifest.yaml +0 -2
- data/.gem_rbs_collection/railties/6.0/patch.rbs +0 -17
- data/.gem_rbs_collection/railties/6.0/railties-generated.rbs +0 -4822
- data/.gem_rbs_collection/railties/6.0/railties.rbs +0 -44
- data/.gem_rbs_collection/rainbow/3.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rainbow/3.0/global.rbs +0 -7
- data/.gem_rbs_collection/rainbow/3.0/presenter.rbs +0 -209
- data/.gem_rbs_collection/rainbow/3.0/rainbow.rbs +0 -5
- data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rake/13.0/manifest.yaml +0 -2
- data/.gem_rbs_collection/rake/13.0/rake.rbs +0 -39
- data/.gem_rbs_collection/regexp_parser/2.8/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/regexp_parser/2.8/regexp_parser.rbs +0 -17
- data/.gem_rbs_collection/rubocop/1.57/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rubocop/1.57/rubocop.rbs +0 -208
- data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +0 -903
- data/.gem_rbs_collection/thor/1.2/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/thor/1.2/thor.rbs +0 -62
- data/.gem_rbs_collection/tzinfo/2.0/.rbs_meta.yaml +0 -9
- data/.gem_rbs_collection/tzinfo/2.0/manifest.yaml +0 -7
- data/.gem_rbs_collection/tzinfo/2.0/tzinfo.rbs +0 -600
- data/.rspec +0 -3
- data/.rubocop.yml +0 -8
- data/.ruby-version +0 -1
- data/CODE_OF_CONDUCT.md +0 -132
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -12
- data/Steepfile +0 -43
- data/lib/decentworks/active_support/time_with_zone_support.rb +0 -327
- data/lib/decentworks/date/support/version.rb +0 -9
- data/lib/decentworks_date_support.rb +0 -4
- data/rbs_collection.lock.yaml +0 -288
- data/rbs_collection.yaml +0 -41
- data/sig/decentworks/active_support/time_with_zone_support.rbs +0 -109
- data/sig/decentworks/date/support.rbs +0 -8
- 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
|