Class: Cell::Concept

Inherits:
ViewModel show all
Defined in:
lib/cell/concept.rb

Instance Attribute Summary

Attributes inherited from ViewModel

#model, #parent_controller

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ViewModel

build, call, #controller_path, #initialize, property, templates, #to_s

Methods included from Util

#util

Methods included from SelfContained

#self_contained!

Methods included from Abstract

#abstract!, #abstract?

Methods included from Layout

included, #process_options!

Methods included from ViewModel::ProcessOptions

#process_options!

Methods included from ViewModel::TemplateFor

#find_template, #template_for

Methods included from Caching

#cache?, #cache_store, included, #render_state

Methods included from ViewModel::Rendering

#call, #render

Methods included from Prefixes

#_prefixes, included

Constructor Details

This class inherits a constructor from Cell::ViewModel

Class Method Details

.class_from_cell_name(name) ⇒ Object



8
9
10
# File 'lib/cell/concept.rb', line 8

def class_from_cell_name(name)
  name.classify.constantize
end

.controller_pathObject



12
13
14
# File 'lib/cell/concept.rb', line 12

def controller_path
  @controller_path ||= util.underscore(name.sub(/::Cell/, ''))
end

Instance Method Details

#cell(name, model = nil, options = {}) ⇒ Object

Get nested cell in instance.



20
21
22
# File 'lib/cell/concept.rb', line 20

def cell(name, model=nil, options={})
  ViewModel.cell(name, model, options.merge(controller: parent_controller)) # #cell calls need to be delegated to ViewModel.
end

#conceptObject

Concept#concept does exactly what #cell does: delegate to class builder.



17
# File 'lib/cell/concept.rb', line 17

alias_method :concept, :cell