Sha256: 70291cfe8f7040596ed19ae82e783a5e573358b65f05099fad01c99486df4d17

Contents?: true

Size: 978 Bytes

Versions: 5

Compression:

Stored size: 978 Bytes

Contents

require "haml"
require "sass/more"
require "monkey"

module Haml
  module More

    # skip autoload lines
    extend Monkey::Autoloader

    # Base class for all all Haml helper
    module AbstractHelper
      module ClassMethods
        def registered(klass)
          klass.helpers self
        end
      end

      def self.included(klass)
        klass.extend ClassMethods
        super
      end

      include Haml::Helpers

      # Will make use of capture_haml depending on whether it is called from
      # within Haml code or not. Thus helpers may be shared between Haml and
      # others (like ERB), but still enjoy all the fancy Haml::Helpers tools.
      def haml_helper(&block)
        return capture_haml(&block) unless is_haml?
        yield
      end

    end

    def self.included(klass)
      Haml::More::CoffeeScript.activate
      klass.send :include, Haml::More::ContentFor
      super
    end

    ::Sinatra.helpers self if defined? ::Sinatra

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
haml-more-0.4.0 lib/haml/more.rb
haml-more-0.4.0.d lib/haml/more.rb
haml-more-0.4.0.c lib/haml/more.rb
haml-more-0.4.0.b lib/haml/more.rb
haml-more-0.4.0.a lib/haml/more.rb