Class: Slimi::Parser
- Inherits:
-
Temple::Parser
- Object
- Temple::Parser
- Slimi::Parser
- Defined in:
- lib/slimi/parser.rb
Defined Under Namespace
Classes: Factory
Instance Method Summary collapse
- #call(source) ⇒ Object
-
#initialize(_options = {}) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(_options = {}) ⇒ Parser
Returns a new instance of Parser.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/slimi/parser.rb', line 26 def initialize( = {}) super @file_path = [:file] || '(__TEMPLATE__)' factory = Factory.new( attribute_delimiters: [:attr_list_delims] || {}, default_tag: [:default_tag] || 'div', ruby_attribute_delimiters: [:code_attr_delims] || {}, shortcut: [:shortcut] || {} ) @attribute_delimiters = factory.attribute_delimiters @attribute_shortcuts = factory.attribute_shortcuts @tag_shortcuts = factory.tag_shortcuts @attribute_shortcut_regexp = factory.attribute_shortcut_regexp @attribute_delimiter_regexp = factory.attribute_delimiter_regexp @quoted_attribute_regexp = factory.quoted_attribute_regexp @tag_name_regexp = factory.tag_name_regexp @attribute_name_regexp = factory.attribute_name_regexp @ruby_attribute_regexp = factory.ruby_attribute_regexp @ruby_attribute_delimiter_regexp = factory.ruby_attribute_delimiter_regexp @ruby_attribute_delimiters = factory.ruby_attribute_delimiters @embedded_template_regexp = factory. end |
Instance Method Details
#call(source) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/slimi/parser.rb', line 49 def call(source) @stacks = [[:multi]] @indents = [] @scanner = ::StringScanner.new(source) parse_block until @scanner.eos? @stacks[0] end |