Class: Padrino::Helpers::OutputHelpers::AbstractHandler Abstract
- Inherits:
-
Object
- Object
- Padrino::Helpers::OutputHelpers::AbstractHandler
- Defined in:
- lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb
Overview
Extend this to create a template handler
Direct Known Subclasses
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#block_is_type?(block) ⇒ Boolean
Returns true if the block given is of the handler’s template type; false otherwise.
-
#capture_from_template(*args, &block) ⇒ Object
Captures the html from a block of template code for this handler.
-
#concat_to_template(text = "") ⇒ Object
Outputs the given text to the templates buffer directly.
-
#engines ⇒ Object
Returns an array of engines used for the template.
-
#initialize(template) ⇒ AbstractHandler
constructor
A new instance of AbstractHandler.
-
#is_type? ⇒ Boolean
Returns true if the current template type is same as this handlers; false otherwise.
-
#template_extension ⇒ Object
Returns extension of the template.
Constructor Details
#initialize(template) ⇒ AbstractHandler
Returns a new instance of AbstractHandler.
30 31 32 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 30 def initialize(template) @template = template end |
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
28 29 30 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 28 def template @template end |
Instance Method Details
#block_is_type?(block) ⇒ Boolean
Returns true if the block given is of the handler’s template type; false otherwise.
72 73 74 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 72 def block_is_type?(block) # Implemented in subclass end |
#capture_from_template(*args, &block) ⇒ Object
Captures the html from a block of template code for this handler
82 83 84 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 82 def capture_from_template(*args, &block) # Implemented in subclass end |
#concat_to_template(text = "") ⇒ Object
Outputs the given text to the templates buffer directly
92 93 94 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 92 def concat_to_template(text="") # Implemented in subclass end |
#engines ⇒ Object
Returns an array of engines used for the template
52 53 54 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 52 def engines # Implemented in subclass end |
#is_type? ⇒ Boolean
Returns true if the current template type is same as this handlers; false otherwise.
62 63 64 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/abstract_handler.rb', line 62 def is_type? # Implemented in subclass end |
#template_extension ⇒ Object
Returns extension of the template
40 41 42 43 44 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/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 |