Sha256: 77e5f4774374c8b97d3aaa48224aa309fa0bd208ca4a752141e8886c87e91fac

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

module Padrino
  module Helpers

    module OutputHelpers
      class HamlHandler < AbstractHandler
        ##
        # Returns true if the current template type is same as this handlers; false otherwise.
        #
        # ==== Examples
        #
        #  @handler.is_type? => true
        #
        def is_type?
          template.respond_to?(:is_haml?) && template.is_haml?
        end

        ##
        # Returns true if the block given is of the handler's template type; false otherwise.
        #
        # ==== Examples
        #
        #  @handler.block_is_type?(block) => true
        #
        def block_is_type?(block)
          template.block_is_haml?(block)
        end

        # Captures the html from a block of template code for this handler
        #
        # ==== Examples
        #
        #  @handler.capture_from_template(&block) => "...html..."
        #
        def capture_from_template(*args, &block)
          template.capture_haml(*args, &block)
        end

        ##
        # Outputs the given text to the templates buffer directly
        #
        # ==== Examples
        #
        #   @handler.concat_to_template("This will be output to the template buffer")
        #
        def concat_to_template(text="")
          template.haml_concat(text)
          nil
        end
      end # HamlHandler

      OutputHelpers.register(HamlHandler)
    end # OutputHelpers
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
padrino-helpers-0.9.24 lib/padrino-helpers/output_helpers/haml_handler.rb
padrino-helpers-0.9.23 lib/padrino-helpers/output_helpers/haml_handler.rb
padrino-helpers-0.9.22 lib/padrino-helpers/output_helpers/haml_handler.rb
padrino-helpers-0.9.21 lib/padrino-helpers/output_helpers/haml_handler.rb