Class: Jbuilder::Schema::Template::TargetWrapper
- Inherits:
-
Object
- Object
- Jbuilder::Schema::Template::TargetWrapper
- Defined in:
- lib/jbuilder/schema/template.rb
Instance Method Summary collapse
-
#initialize(object) ⇒ TargetWrapper
constructor
A new instance of TargetWrapper.
-
#to_s ⇒ Object
(also: #unwrap_target!)
Rails 7.1 calls ‘to_s` on our `target!` (the return value from our templates).
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_s ⇒ Object 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 |