Module: Taro::Types::Shared::Rendering

Defined in:
lib/taro/types/shared/rendering.rb

Instance Method Summary collapse

Instance Method Details

#last_renderObject



14
15
16
# File 'lib/taro/types/shared/rendering.rb', line 14

def last_render
  ActiveSupport::IsolatedExecutionState[:taro_last_render]
end

#last_render=(info) ⇒ Object



10
11
12
# File 'lib/taro/types/shared/rendering.rb', line 10

def last_render=(info)
  ActiveSupport::IsolatedExecutionState[:taro_last_render] = info
end

#render(object) ⇒ Object

The ‘::render` method is intended for use in controllers. Overrides of this method must call super.



4
5
6
7
8
# File 'lib/taro/types/shared/rendering.rb', line 4

def render(object)
  result = new(object).coerce_response
  self.last_render = [self, result.__id__]
  result
end

#used_in_responseObject

get the last used type for assertions in tests/specs



19
20
21
# File 'lib/taro/types/shared/rendering.rb', line 19

def used_in_response
  last_render.to_a.first
end