Module: LatoCore::Helper::Cells

Included in:
LatoCore::Helper
Defined in:
lib/lato_core/helpers/cells.rb

Overview

This module contains helpers used to manage cells.

Instance Method Summary collapse

Instance Method Details

#cell(*names) ⇒ Object

This helper is used to create a new cell with a pretty format.



7
8
9
10
11
12
13
14
15
16
# File 'lib/lato_core/helpers/cells.rb', line 7

def cell(*names)
  # define variables
  names_list = names.first.to_s.start_with?('Lato') ? names[1..-1] : names
  cell_class = names.first.to_s.start_with?('Lato') ? "#{names.first}::" : 'LatoCore::'
  # return correct cell
  names_list.each do |name|
    cell_class = "#{cell_class}#{name.capitalize}::"
  end
  "#{cell_class}Cell".constantize
end