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.
60 61 62 |
# File 'lib/jbuilder/schema/template.rb', line 60 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.
67 68 69 |
# File 'lib/jbuilder/schema/template.rb', line 67 def to_s @object end |