Class: Hamlit::Parser
Constant Summary collapse
- AVAILABLE_OPTIONS =
%i[ autoclose escape_html escape_attrs ].freeze
Instance Method Summary collapse
- #call(template) ⇒ Object
-
#initialize(options = {}) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(options = {}) ⇒ Parser
Returns a new instance of Parser.
21 22 23 24 25 26 |
# File 'lib/hamlit/parser.rb', line 21 def initialize( = {}) @options = HamlOptions.defaults.dup AVAILABLE_OPTIONS.each do |key| @options[key] = [key] end end |
Instance Method Details
#call(template) ⇒ Object
28 29 30 31 32 |
# File 'lib/hamlit/parser.rb', line 28 def call(template) HamlParser.new(template, HamlOptions.new(@options)).parse rescue ::Hamlit::HamlError => e error_with_lineno(e) end |