Class: Jbuilder::Schema::Template::TargetWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/jbuilder/schema/template.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ TargetWrapper

Returns a new instance of TargetWrapper.



60
61
62
# File 'lib/jbuilder/schema/template.rb', line 60

def initialize(object)
  @object = object
end

Instance Method Details

#to_sObject Also known as: unwrap_target!

Rails 7.1 calls ‘to_s` on our `target!` (the return value from our templates). To get around that and let our inner Hash through, we add this override. `unwrap_target!` is added for backwards compatibility so we get the inner Hash on Rails < 7.1.



67
68
69
# File 'lib/jbuilder/schema/template.rb', line 67

def to_s
  @object
end