class Voom::Presenters::DSL::Components::Base
Every object in the POM is a node This class provides common base implementation
Attributes
attribs[R]
attributes[R]
css_class[R]
draggable[R]
drop_zone[R]
id[R]
tag[R]
type[R]
Public Class Methods
new(type:, parent:, id: nil, tag: nil, **attributes, &block)
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 22 def initialize(type:, parent:, id: nil, tag: nil, **attributes, &block) @draggable = attributes.delete(:draggable) {nil} @drop_zone = attributes.delete(:drop_zone) {nil} @css_class = Array(attributes.delete(:class) {nil}) @id = id || generate_id @tag = tag @type = type @parent = parent @attributes = attributes @block = block initialize_plugins end
Public Instance Methods
expand!()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 35 def expand! extend(_helpers_) if _helpers_ instance_eval(&@block) if @block end
Protected Instance Methods
_helpers_()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 81 def _helpers_ @parent.send(:_helpers_) if @parent end
_plugins_()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 89 def _plugins_ @parent.send(:_plugins_) if @parent end
context()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 69 def context @parent.send(:context) end
Also aliased as: params
default(key)
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 93 def default(key) Settings.default(type, key) end
name()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 61 def name @parent.send(:name) end
namespace()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 65 def namespace @parent.send(:namespace) end
parent(for_type)
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 52 def parent(for_type) return @parent if @parent.type == for_type @parent.send(:parent, for_type) end
plugin(*plugin_names)
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 85 def plugin(*plugin_names) @parent.send(:plugin, *plugin_names) if @parent end
router()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 57 def router @parent.send(:router) end
yield_block()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 76 def yield_block return @_yield_block_ if @_yield_block_ @parent.send(:yield_block) end
Private Instance Methods
generate_id()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 46 def generate_id Voom::Presenters::Settings.config.presenters.id_generator.call(self) end
initialize_plugins()
click to toggle source
# File lib/voom/presenters/dsl/components/base.rb, line 42 def initialize_plugins self.class.include_plugins(:DSLComponents, :DSLHelpers, plugins: _plugins_) end