Module: Cell::ViewModel::Rendering
- Included in:
- Cell::ViewModel
- Defined in:
- lib/cell/view_model.rb
Instance Method Summary collapse
-
#call(state = :show, *args, &block) ⇒ Object
Invokes the passed method (defaults to :show) while respecting caching.
-
#render(options = {}, &block) ⇒ Object
render :show.
-
#show(&block) ⇒ Object
Since 4.1, you get the #show method for free.
Instance Method Details
#call(state = :show, *args, &block) ⇒ Object
Invokes the passed method (defaults to :show) while respecting caching. In Rails, the return value gets marked html_safe.
91 92 93 94 |
# File 'lib/cell/view_model.rb', line 91 def call(state=:show, *args, &block) content = render_state(state, *args, &block) content.to_s end |
#render(options = {}, &block) ⇒ Object
render :show
102 103 104 105 |
# File 'lib/cell/view_model.rb', line 102 def render(={}, &block) = () render_to_string(, &block) end |
#show(&block) ⇒ Object
Since 4.1, you get the #show method for free.
97 98 99 |
# File 'lib/cell/view_model.rb', line 97 def show(&block) render(&block) end |