Module: Cell::ViewModel::Rendering

Included in:
Cell::ViewModel
Defined in:
lib/cell/view_model.rb

Instance Method Summary collapse

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.



77
78
79
80
# File 'lib/cell/view_model.rb', line 77

def call(state=:show, *args, &block)
  content = render_state(state, *args, &block)
  content.to_s
end

#render(options = {}, &block) ⇒ Object

render :show



88
89
90
91
# File 'lib/cell/view_model.rb', line 88

def render(options={}, &block)
  options = normalize_options(options)
  render_to_string(options, &block)
end

#show(&block) ⇒ Object

Since 4.1, you get the #show method for free.



83
84
85
# File 'lib/cell/view_model.rb', line 83

def show(&block)
  render(&block)
end