Sha256: 9694fec7e04e2defe0dc3fd2677ab89d073f9e2b7d9ae4af461465c439db411b
Contents?: true
Size: 1014 Bytes
Versions: 2
Compression:
Stored size: 1014 Bytes
Contents
class Shortcode::TemplateBinding def initialize(name, configuration, attributes=[], content="", additional_attributes=nil) @configuration = configuration include_helper_modules presenter = Shortcode::Presenter.new name, configuration, map_attributes(attributes), content, additional_attributes @name = name @attributes = presenter.attributes @content = presenter.content end # Expose private binding() method for use with erb templates def expose_binding binding end private attr_reader :configuration def map_attributes(attributes) hash = {} attributes.each { |o| hash[o[:key].to_sym] = o[:value] } hash end def include_helper_modules return unless configuration.helpers.any? configuration.helpers.each do |helper| self.class.send(:include, helper) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shortcode-2.0.0 | lib/shortcode/template_binding.rb |
shortcode-2.0.0.pre | lib/shortcode/template_binding.rb |