actionview-component 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31181269a68b440c741ff9665ef8cb4df10c7e55bb2b0253423e19ffa96807ab
4
- data.tar.gz: e851b3a851e95328c969539bad6f02a35311828d5037ea16d21d775651ddf500
3
+ metadata.gz: 03a3c04aa78f3fcc16c350b49955870f60e712ad0383eb924e7053d7208431d0
4
+ data.tar.gz: 299741730bcfe4eb6640e5899e3973d4fd303dc28aadc79103eb72bdcd2382ec
5
5
  SHA512:
6
- metadata.gz: eb1cca60238b879c6452688b59ebce47e436493f7b9031871c3099cbcb876f57cd37c020cff59ce09b70ba821d6e1f075c97739753525158acb7d7caa0e5c279
7
- data.tar.gz: 0341cf5c599e0453ec78ce7f5131411a55dd73253db7b78019a136899d84bbab01d153c0157038d71d484646617bd26e81bf6caae8ab691e1c11f983e533ae99
6
+ metadata.gz: '01091f9da0436fcbfcbdfd602bcf7595c9c061738f49b9fb70305474218b6b928382daed58c4a3ebc1d08991815ecc965cc6a19b8c4384c35338d672ee5b456e'
7
+ data.tar.gz: 32fae5a27cb1f1f939ce5b59947b3785f1b4ee73a8e9b3b1a95eb1351800aa005518b61b6f24d8570790c1e45d128bf87ab28e4f14cecac1479d33a4ed30a524
@@ -1,3 +1,13 @@
1
+ # v1.3.4
2
+
3
+ * Template errors surface correct file and line number.
4
+
5
+ *Justin Coyne*
6
+
7
+ * Allow access to `request` inside components.
8
+
9
+ *Joel Hawksley*
10
+
1
11
  # v1.3.3
2
12
 
3
13
  * Do not raise error when sidecar files that are not templates exist.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- actionview-component (1.3.3)
4
+ actionview-component (1.3.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "actionview-component"
9
- spec.version = "1.3.3"
9
+ spec.version = "1.3.4"
10
10
  spec.authors = ["GitHub Open Source"]
11
11
  spec.email = ["opensource+actionview-component@github.com"]
12
12
 
@@ -60,7 +60,6 @@ module ActionView
60
60
  #
61
61
  def render_in(view_context, *args, &block)
62
62
  self.class.compile
63
- self.controller = view_context.controller
64
63
  @view_context = view_context
65
64
  @view_renderer ||= view_context.view_renderer
66
65
  @lookup_context ||= view_context.lookup_context
@@ -94,7 +93,12 @@ module ActionView
94
93
  def compile
95
94
  return if @compiled && ActionView::Base.cache_template_loading
96
95
 
97
- class_eval("def call; @output_buffer = ActionView::OutputBuffer.new; #{compiled_template}; end")
96
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
97
+ def call
98
+ @output_buffer = ActionView::OutputBuffer.new
99
+ #{compiled_template}
100
+ end
101
+ RUBY
98
102
 
99
103
  @compiled = true
100
104
  end
@@ -152,6 +156,14 @@ module ActionView
152
156
 
153
157
  private
154
158
 
159
+ def controller
160
+ @controller ||= view_context.controller
161
+ end
162
+
163
+ def request
164
+ @request ||= controller.request
165
+ end
166
+
155
167
  attr_reader :content, :view_context
156
168
  end
157
169
  end
@@ -8,7 +8,11 @@ module ActionView
8
8
  end
9
9
 
10
10
  def controller
11
- @controller ||= ApplicationController.new.tap { |c| c.request = ActionDispatch::TestRequest.create }
11
+ @controller ||= ApplicationController.new.tap { |c| c.request = request }
12
+ end
13
+
14
+ def request
15
+ @request ||= ActionDispatch::TestRequest.create
12
16
  end
13
17
 
14
18
  def render_component(component, **args, &block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-02 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler