Method: LatoView::ApplicationHelper#view

Defined in:
app/helpers/lato_view/application_helper.rb

#view(*names) ⇒ Object

This function render a cell set with params.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/lato_view/application_helper.rb', line 6

def view(*names)
  # mantain compatibility with old cells (lato_view 1.0)
  if names.length === 1
    puts "YOU ARE USING AND OLD VERSION OF CELLS. PLEASE CONSIDER TO UPDATE YOUR CODE"
    old_cell = "LatoView::CellsV1::#{names.first.capitalize}::Cell".constantize
    return old_cell
  end
  # return correct cell
  cell_class = "LatoView::"
  names.each do |name|
    cell_class = "#{cell_class}#{name.capitalize}::"
  end
  cell_class = "#{cell_class}Cell".constantize
  return cell_class
end