Class: Haml::Plugin
- Inherits:
-
Object
- Object
- Haml::Plugin
- Includes:
- Util
- Defined in:
- /build/buildd/ruby-haml-3.1.4/lib/haml/template/plugin.rb
Overview
In Rails 3.1+, template handlers don’t inherit from anything. In <= 3.0, they do. To avoid messy logic figuring this out, we just inherit from whatever the ERB handler does.
Constant Summary
Constants included from Util
Class Method Summary (collapse)
-
+ call(template)
In Rails 3.1+, #call takes the place of #compile.
Instance Method Summary (collapse)
Methods included from Util
#abstract, #ap_geq?, #ap_geq_3?, #assert_html_safe!, #av_template_class, #caller_info, #check_encoding, #check_haml_encoding, #def_static_method, #dump, #enum_cons, #enum_slice, #enum_with_index, #flatten, #haml_warn, #has?, #html_safe, #inspect_obj, #intersperse, #ironruby?, #lcs, #load, #map_hash, #map_keys, #map_vals, #merge_adjacent_strings, #ord, #paths, #powerset, #rails_env, #rails_root, #rails_safe_buffer_class, #rails_xss_safe?, #restrict, #ruby1_8?, #ruby1_8_6?, #scope, #set_eql?, #set_hash, #silence_haml_warnings, #silence_warnings, #static_method_name, #strip_string_array, #substitute, #to_hash, #try_sass, #version_geq, #version_gt, #windows?
Class Method Details
+ call(template)
In Rails 3.1+, #call takes the place of #compile
38 39 40 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/template/plugin.rb', line 38
def self.call(template)
new.compile(template)
end
|
Instance Method Details
- cache_fragment(block, name = {}, options = nil)
42 43 44 45 46 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/template/plugin.rb', line 42
def cache_fragment(block, name = {}, options = nil)
@view.fragment_for(block, name, options) do
eval("_hamlout.buffer", block.binding)
end
end
|
- compile(template)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/template/plugin.rb', line 21
def compile(template)
options = Haml::Template.options.dup
# template is a template object in Rails >=2.1.0,
# a source string previously
if template.respond_to? :source
# Template has a generic identifier in Rails >=3.0.0
options[:filename] = template.respond_to?(:identifier) ? template.identifier : template.filename
source = template.source
else
source = template
end
Haml::Engine.new(source, options).send(:precompiled_with_ambles, [])
end
|
- (Boolean) handles_encoding?
19 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/template/plugin.rb', line 19
def handles_encoding?; true end
|