Sha256: f64fa21d977f00f65b36beec50ce34932ecb2888475b54c43beab7d5a97c139a
Contents?: true
Size: 986 Bytes
Versions: 2
Compression:
Stored size: 986 Bytes
Contents
module ExpressTemplates module Components class Container < Base include Capabilities::Configurable include Capabilities::Hideable abstract_component class_attribute :prepended_blocks self.prepended_blocks = [] class_attribute :appended_blocks self.appended_blocks = [] contains -> (&block) { prepended block.call(self) if block appended } def prepended prepended_blocks.each do |block_to_prepend| call_block(block_to_prepend) end end def appended appended_blocks.each do |block_to_append| call_block(block_to_append) end end def call_block(block) instance_exec(&block) end def self.prepends(proc = nil, &block) self.prepended_blocks += [proc || block] end def self.appends(proc = nil, &block) self.appended_blocks += [proc || block] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
express_templates-0.11.20 | lib/express_templates/components/container.rb |
express_templates-0.11.20.rc1 | lib/express_templates/components/container.rb |