Skip to content

Commit 6732db4

Browse files
authored
Replace deprecated ProxyObject with BasicObject (#563)
1 parent 0919e3f commit 6732db4

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

lib/jbuilder.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def _extract_method_values(object, attributes)
295295

296296
def _merge_block(key)
297297
current_value = _blank? ? BLANK : @attributes.fetch(_key(key), BLANK)
298-
raise NullError.build(key) if current_value.nil?
298+
::Kernel.raise NullError.build(key) if current_value.nil?
299299
new_value = _scope{ yield self }
300300
_merge_values(current_value, new_value)
301301
end
@@ -310,7 +310,7 @@ def _merge_values(current_value, updates)
310310
elsif ::Hash === current_value && ::Hash === updates
311311
current_value.deep_merge(updates)
312312
else
313-
raise MergeError.build(current_value, updates)
313+
::Kernel.raise MergeError.build(current_value, updates)
314314
end
315315
end
316316

@@ -331,8 +331,8 @@ def _format_keys(hash_or_array)
331331
end
332332

333333
def _set_value(key, value)
334-
raise NullError.build(key) if @attributes.nil?
335-
raise ArrayError.build(key) if ::Array === @attributes
334+
::Kernel.raise NullError.build(key) if @attributes.nil?
335+
::Kernel.raise ArrayError.build(key) if ::Array === @attributes
336336
return if @ignore_nil && value.nil? or _blank?(value)
337337
@attributes = {} if _blank?
338338
@attributes[_key(key)] = value

lib/jbuilder/jbuilder.rb

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
Jbuilder = Class.new(begin
2-
require 'active_support/proxy_object'
3-
ActiveSupport::ProxyObject
4-
rescue LoadError
5-
require 'active_support/basic_object'
6-
ActiveSupport::BasicObject
7-
end)
1+
Jbuilder = Class.new(BasicObject)

lib/jbuilder/jbuilder_template.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def cache!(key=nil, options={})
8989
# # json.extra 'This will not work either, the root must be exclusive'
9090
def cache_root!(key=nil, options={})
9191
if @context.controller.perform_caching
92-
raise "cache_root! can't be used after JSON structures have been defined" if @attributes.present?
92+
::Kernel.raise "cache_root! can't be used after JSON structures have been defined" if @attributes.present?
9393

9494
@cached_root = _cache_fragment_for([ :root, key ], options) { yield; target! }
9595
else
@@ -148,11 +148,11 @@ def _render_partial_with_options(options)
148148
collection = EnumerableCompat.new(collection) if collection.respond_to?(:count) && !collection.respond_to?(:size)
149149

150150
if options.has_key?(:layout)
151-
raise ::NotImplementedError, "The `:layout' option is not supported in collection rendering."
151+
::Kernel.raise ::NotImplementedError, "The `:layout' option is not supported in collection rendering."
152152
end
153153

154154
if options.has_key?(:spacer_template)
155-
raise ::NotImplementedError, "The `:spacer_template' option is not supported in collection rendering."
155+
::Kernel.raise ::NotImplementedError, "The `:spacer_template' option is not supported in collection rendering."
156156
end
157157

158158
results = CollectionRenderer

0 commit comments

Comments
 (0)