Module: Taro::Types::Shared::Rendering
- Defined in:
- lib/taro/types/shared/rendering.rb
Instance Method Summary collapse
- #last_render ⇒ Object
- #last_render=(info) ⇒ Object
-
#render(object, cache_attrs = {}) ⇒ Object
The ‘::render` method is intended for use in controllers.
-
#used_in_response ⇒ Object
get the last used type for assertions in tests/specs.
Instance Method Details
#last_render ⇒ Object
16 17 18 |
# File 'lib/taro/types/shared/rendering.rb', line 16 def last_render ActiveSupport::IsolatedExecutionState[:taro_last_render] end |
#last_render=(info) ⇒ Object
12 13 14 |
# File 'lib/taro/types/shared/rendering.rb', line 12 def last_render=(info) ActiveSupport::IsolatedExecutionState[:taro_last_render] = info end |
#render(object, cache_attrs = {}) ⇒ Object
The ‘::render` method is intended for use in controllers. Overrides of this method must call super.
4 5 6 7 8 9 10 |
# File 'lib/taro/types/shared/rendering.rb', line 4 def render(object, cache_attrs = {}) result = Taro::Cache.call(object, **cache_attrs) do new(object).cached_coerce_response end self.last_render = [type_class, result.__id__] result end |
#used_in_response ⇒ Object
get the last used type for assertions in tests/specs
21 22 23 |
# File 'lib/taro/types/shared/rendering.rb', line 21 def used_in_response last_render.to_a.first end |