leanweb 0.5.2 → 0.5.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 +4 -4
- data/lib/leanweb/route.rb +18 -7
- data/lib/leanweb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4420d0acf838a96016cabcbdf4fb5977044c4c43c7102bbb7c520dab34a3908
|
4
|
+
data.tar.gz: 861d7f89f86f9749ac69e007ffd23218047f6cabf825a53074df2aab953e9bb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3377a07bfdee4a0fe5ebfdd40d3094786ac204b2301eafbf796b296bcce86ab6728352246f74abea581d5910f0f3868d5d11c7706ee4f61ce5275f74914365c4
|
7
|
+
data.tar.gz: 616f2bcc6979253f43d20135a72a3537c6eb3680278c39fa73c879e0a088434c1242f10f200202ab0ec5533c746cab0ca971e655ed79956cdd3f3bca6886bac8
|
data/lib/leanweb/route.rb
CHANGED
@@ -72,9 +72,6 @@ module LeanWeb
|
|
72
72
|
return respond_proc(request) if @action.instance_of?(Proc)
|
73
73
|
|
74
74
|
respond_method(request)
|
75
|
-
rescue NoMethodError
|
76
|
-
controller = default_controller_class.new(self)
|
77
|
-
controller.default_static_action(guess_view_path)
|
78
75
|
end
|
79
76
|
|
80
77
|
# String path, independent if {#path} is Regexp or String.
|
@@ -157,14 +154,28 @@ module LeanWeb
|
|
157
154
|
Controller
|
158
155
|
end
|
159
156
|
|
157
|
+
def default_static_action
|
158
|
+
default_controller_class.new(self).default_static_action(guess_view_path)
|
159
|
+
end
|
160
|
+
|
161
|
+
def controller_for_request(request)
|
162
|
+
require_relative("#{CONTROLLER_PATH}/#{@action.controller.to_s.snakeize}")
|
163
|
+
Object.const_get(@action.controller).new(self, request)
|
164
|
+
rescue LoadError
|
165
|
+
nil
|
166
|
+
end
|
167
|
+
|
160
168
|
# @param request [Rack::Request]
|
161
169
|
# @return [Array] a valid Rack response.
|
162
170
|
def respond_method(request)
|
163
171
|
params = action_params(request.path)
|
164
|
-
|
165
|
-
|
166
|
-
return
|
167
|
-
|
172
|
+
controller = controller_for_request(request)
|
173
|
+
|
174
|
+
return default_static_action unless
|
175
|
+
controller&.class&.method_defined?(@action.action)
|
176
|
+
|
177
|
+
return controller.public_send(@action.action, **params) if
|
178
|
+
params.instance_of?(Hash)
|
168
179
|
|
169
180
|
controller.public_send(@action.action, *params)
|
170
181
|
end
|
data/lib/leanweb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leanweb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Freeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
|
-
rubygems_version: 3.4.
|
225
|
+
rubygems_version: 3.4.10
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: LeanWeb is a minimal hybrid static / dynamic web framework
|