Sha256: 4f9d4fcd4f343b419c4d60b59a5972c59048ea0bc498eaef2aa553cdd037f126

Contents?: true

Size: 821 Bytes

Versions: 41

Compression:

Stored size: 821 Bytes

Contents

class Shortcode::TemplateBinding

  def initialize(name, attributes=[], content='', additional_attributes=nil)
    include_helper_modules
    presenter   = Shortcode::Presenter.new name, set_attributes(attributes), content, additional_attributes
    @name       = name
    @attributes = presenter.attributes
    @content    = presenter.content
  end

  # Expose private binding() method for use with erb templates
  def get_binding
    binding
  end

  private

    def set_attributes(attributes)
      hash = {}
      attributes.each { |o| hash[o[:key].to_sym] = o[:value] }
      hash
    end

    def include_helper_modules
      return unless Shortcode.configuration.helpers.any?
      class << self
        Shortcode.configuration.helpers.each do |helper|
          include helper
        end
      end
    end

end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
virgo-0.3.17 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.16 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.15 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.14 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.13 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.12 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.11 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.10 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.9 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.8 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.7 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.6 vendor/gems/shortcode/lib/shortcode/template_binding.rb
shortcode-1.1.1 lib/shortcode/template_binding.rb
virgo-0.3.4 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.3 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.2 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3.1 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.3 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.2.9 vendor/gems/shortcode/lib/shortcode/template_binding.rb
virgo-0.2.8 vendor/gems/shortcode/lib/shortcode/template_binding.rb