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.



78
79
80
# File 'lib/jbuilder/schema/template.rb', line 78

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.



85
86
87
# File 'lib/jbuilder/schema/template.rb', line 85

def to_s
  @object
end