class Glia::Layout
Attributes
cells[R]
data[R]
handles[R]
themes[R]
update[R]
view_factory[W]
Public Class Methods
new(area, handles, options = {})
click to toggle source
# File lib/glia/layout.rb, line 11 def initialize(area, handles, options = {}) @area = area @themes = options[:theme_inheritance] || [:default] @update = UpdateRegistry.merge_themes(area, ) @cells = {} @handles = handles @data = @update.merge(@handles) @view_factory = options[:view_factory] unless options[:view_factory].nil? end
Public Instance Methods
cell(name, *args)
click to toggle source
# File lib/glia/layout.rb, line 21 def cell(name, *args) if @cells[name].nil? definition = @data[name] raise Errors::MissingCellError, "Cell #{name} is missing from layout #{@area}" if definition.nil? code = definition.delete(:class) actions = definition.delete(:actions) children = definition.delete(:children) namespace = definition.delete(:view_namespace) || Object @cells[name] = view_factory.build(code, namespace, definition, actions, *args) unless @cells[name].respond_to?(:child_definitions=) raise Errors::InvalidCellError, @cells[name].class.name+' is not a valid cell. Include Glia::Cell.' end @cells[name].child_definitions = children @cells[name].layout = self end @cells[name] end
view_factory()
click to toggle source
# File lib/glia/layout.rb, line 39 def view_factory @view_factory ||= ViewFactory.new end