Parent

Files

Padrino::Helpers::OutputHelpers::AbstractHandler

@abstract Extend this to create a template handler

Attributes

template[R]

Public Class Methods

new(template) click to toggle source
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 30
def initialize(template)
  @template = template
end

Public Instance Methods

block_is_type?(block) click to toggle source

Returns true if the block given is of the handler’s template type; false otherwise.

@example

@handler.block_is_type?(block) => true
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 72
def block_is_type?(block)
  # Implemented in subclass
end
capture_from_template(*args, &block) click to toggle source

Captures the html from a block of template code for this handler

@example

@handler.capture_from_template(&block) => "...html..."
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 82
def capture_from_template(*args, &block)
  # Implemented in subclass
end
concat_to_template(text="") click to toggle source

Outputs the given text to the templates buffer directly

@example

@handler.concat_to_template("This will be output to the template buffer")
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 92
def concat_to_template(text="")
  # Implemented in subclass
end
engines() click to toggle source

Returns an array of engines used for the template

@example

@handler.engines => [:erb, :erubis]
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 52
def engines
  # Implemented in subclass
end
is_type?() click to toggle source

Returns true if the current template type is same as this handlers; false otherwise.

@example

@handler.is_type? => true
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 62
def is_type?
  # Implemented in subclass
end
template_extension() click to toggle source

Returns extension of the template

@example

@handler.template_extension => "erb"
# File lib/padrino-helpers/output_helpers/abstract_handler.rb, line 40
def template_extension
  caller.find { |c| c =~ /\/views\// }[/\.([\w]*?)\:/, 1] rescue nil
  # "/some/path/app/views/posts/foo.html.erb:3:in `evaluate_source'"
  # => "erb"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.