Sha256: 79b0f95c999b900b18c7c3e5df76b459a1f031ac01adf21f12b344d7f1fdd25b

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Metamagic
  module ViewHelper
    def meta(hash = {})
      metamagic_renderer.add hash
    end

    def metamagic(hash = {})
      # Loop through special options
      hash.slice(:title_template, :site).each do |key, value|
        metamagic_renderer.send("#{key}=", value)
        hash.delete key
      end

      metamagic_renderer.add hash
      metamagic_renderer.render
    end

    def method_missing(method, *args, &block)
      if metamagic_renderer.has_tag_type?(method)
        meta method => args.first
      else
        super
      end
    end

    private

    def metamagic_renderer
      @metamagic_renderer ||= Renderer.new(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metamagic-3.1.0 lib/metamagic/view_helper.rb