stimulus_reflex 2.1.6 → 2.1.7

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
  SHA256:
3
- metadata.gz: 9c50e78b9a8b062de4ba60f8a8e88443f15b3bab6f358f0630404c182b437637
4
- data.tar.gz: adbde92dcb054bcd58bc8a8744a2d41c202d8e7692b85fdef1321a7df9d392c6
3
+ metadata.gz: 7358f3c72c8e21891a1b5ff2a61905225874f1a4fb9ab6a6ec2246a86694925d
4
+ data.tar.gz: 002c186526500e8d7436cd55fdcdde2d4338d76ebb612963e2f0370b1ce7bf7a
5
5
  SHA512:
6
- metadata.gz: aaaffe8eff72bbc991b450485304055a7bfda5fee5ce06e91859d14998ba4d45b1b3ba23cdc1f9466861ceccc71189613e9895c568b8ea9b637cd4e3387f6ee9
7
- data.tar.gz: d22df6b0a4e31e59f09ee83c236a5881b7804e6e0ae66467764ce2fb4ef1000b2dcfc7dfec0b70efe75ce35c18a8e5020bc1789c57b8f130252fb6502f08af19
6
+ metadata.gz: 8cdd04587e3a3e9f38d1505efcf5fb3701469356eeb4c6873fc106a5aac035d4d6656c200fc3e8889d63dadbdc50dcf7515901392dd3eb31f50677c05792a328
7
+ data.tar.gz: 88f4c15ab3ac1fb8f55ec590f088795ef9e89400d235ad939f92d09d9b8056cb0b1b55e7de254bc1273055214dc876dca67b81194dc506d202654140170608e2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stimulus_reflex (2.1.6)
4
+ stimulus_reflex (2.1.7)
5
5
  cable_ready (>= 4.0)
6
6
  nokogiri
7
7
  rack
@@ -94,7 +94,7 @@ GEM
94
94
  nokogiri (1.10.7)
95
95
  mini_portile2 (~> 2.4.0)
96
96
  parallel (1.19.1)
97
- parser (2.6.5.0)
97
+ parser (2.7.0.0)
98
98
  ast (~> 2.4.0)
99
99
  pry (0.12.2)
100
100
  coderay (~> 1.1.0)
@@ -139,7 +139,7 @@ GEM
139
139
  rainbow (>= 2.2.2, < 4.0)
140
140
  ruby-progressbar (~> 1.7)
141
141
  unicode-display_width (>= 1.4.0, < 1.7)
142
- rubocop-performance (1.5.1)
142
+ rubocop-performance (1.5.2)
143
143
  rubocop (>= 0.71.0)
144
144
  ruby-progressbar (1.10.1)
145
145
  sprockets (4.0.0)
@@ -156,7 +156,7 @@ GEM
156
156
  standard
157
157
  thor (1.0.1)
158
158
  thread_safe (0.3.6)
159
- tzinfo (1.2.5)
159
+ tzinfo (1.2.6)
160
160
  thread_safe (~> 0.1)
161
161
  unicode-display_width (1.6.0)
162
162
  websocket-driver (0.7.1)
@@ -71,29 +71,28 @@ class StimulusReflex::Channel < ActionCable::Channel::Base
71
71
 
72
72
  def render_page(url, reflex)
73
73
  uri = URI.parse(url)
74
- url_params = Rails.application.routes.recognize_path(url)
75
- controller_class = "#{url_params[:controller]}_controller".classify.constantize
76
- controller = controller_class.new
74
+ query_hash = Rack::Utils.parse_nested_query(uri.query)
75
+ request = ActionDispatch::Request.new(
76
+ connection.env.merge(
77
+ Rack::MockRequest.env_for(uri.to_s).merge(
78
+ "rack.request.query_hash" => query_hash,
79
+ "rack.request.query_string" => uri.query,
80
+ "ORIGINAL_SCRIPT_NAME" => "",
81
+ "ORIGINAL_FULLPATH" => uri.path,
82
+ Rack::SCRIPT_NAME => "",
83
+ Rack::PATH_INFO => uri.path,
84
+ Rack::REQUEST_PATH => uri.path,
85
+ Rack::QUERY_STRING => uri.query,
86
+ )
87
+ )
88
+ )
89
+ url_params = Rails.application.routes.recognize_path_with_request(request, url, request.env[:extras] || {})
90
+ controller = request.controller_class.new
77
91
  controller.instance_variable_set :"@stimulus_reflex", true
78
92
  reflex.instance_variables.each do |name|
79
93
  controller.instance_variable_set name, reflex.instance_variable_get(name)
80
94
  end
81
95
 
82
- query_hash = Rack::Utils.parse_nested_query(uri.query)
83
- env = {
84
- "action_dispatch.request.path_parameters" => url_params,
85
- "action_dispatch.request.query_parameters" => query_hash,
86
- "rack.request.query_hash" => query_hash,
87
- "rack.request.query_string" => uri.query,
88
- "ORIGINAL_SCRIPT_NAME" => "",
89
- "ORIGINAL_FULLPATH" => uri.path,
90
- Rack::SCRIPT_NAME => "",
91
- Rack::PATH_INFO => uri.path,
92
- Rack::REQUEST_PATH => uri.path,
93
- Rack::QUERY_STRING => uri.query,
94
- }
95
-
96
- request = ActionDispatch::Request.new(connection.env.merge(env))
97
96
  controller.request = request
98
97
  controller.response = ActionDispatch::Response.new
99
98
  controller.process url_params[:action]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusReflex
4
- VERSION = "2.1.6"
4
+ VERSION = "2.1.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus_reflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-20 00:00:00.000000000 Z
11
+ date: 2019-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack