Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated ProxyObject with BasicObject #563

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/jbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _extract_method_values(object, attributes)

def _merge_block(key)
current_value = _blank? ? BLANK : @attributes.fetch(_key(key), BLANK)
raise NullError.build(key) if current_value.nil?
::Kernel.raise NullError.build(key) if current_value.nil?
new_value = _scope{ yield self }
_merge_values(current_value, new_value)
end
Expand All @@ -307,7 +307,7 @@ def _merge_values(current_value, updates)
elsif ::Hash === current_value && ::Hash === updates
current_value.deep_merge(updates)
else
raise MergeError.build(current_value, updates)
::Kernel.raise MergeError.build(current_value, updates)
end
end

Expand All @@ -328,8 +328,8 @@ def _format_keys(hash_or_array)
end

def _set_value(key, value)
raise NullError.build(key) if @attributes.nil?
raise ArrayError.build(key) if ::Array === @attributes
::Kernel.raise NullError.build(key) if @attributes.nil?
::Kernel.raise ArrayError.build(key) if ::Array === @attributes
return if @ignore_nil && value.nil? or _blank?(value)
@attributes = {} if _blank?
@attributes[_key(key)] = value
Expand Down
8 changes: 1 addition & 7 deletions lib/jbuilder/jbuilder.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
Jbuilder = Class.new(begin
require 'active_support/proxy_object'
ActiveSupport::ProxyObject
rescue LoadError
require 'active_support/basic_object'
ActiveSupport::BasicObject
end)
Jbuilder = Class.new(BasicObject)
6 changes: 3 additions & 3 deletions lib/jbuilder/jbuilder_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def cache!(key=nil, options={})
# # json.extra 'This will not work either, the root must be exclusive'
def cache_root!(key=nil, options={})
if @context.controller.perform_caching
raise "cache_root! can't be used after JSON structures have been defined" if @attributes.present?
::Kernel.raise "cache_root! can't be used after JSON structures have been defined" if @attributes.present?

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

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

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

results = CollectionRenderer
Expand Down