Sha256: 5e39bcab041783b0a010e28bfd7beb6583aa56190c33ce24d89250ef7fc223b9
Contents?: true
Size: 995 Bytes
Versions: 35
Compression:
Stored size: 995 Bytes
Contents
require 'volt/server/html_parser/sandlebars_parser' require 'volt/server/html_parser/view_scope' require 'volt/server/html_parser/if_view_scope' require 'volt/server/html_parser/view_handler' require 'volt/server/html_parser/each_scope' require 'volt/server/html_parser/textarea_scope' class ViewParser attr_reader :templates def initialize(html, template_path) @template_path = template_path handler = ViewHandler.new(template_path) SandlebarsParser.new(html, handler) # Close out the last scope handler.scope.last.close_scope @templates = handler.templates end # Returns a parsed version of the data (useful for backend rendering # and testing) def data templates = @templates.deep_clone templates.each_pair do |name, value| if value['bindings'] value['bindings'].each_pair do |number, binding| value['bindings'][number] = binding.map {|code| eval(code) } end end end return templates end end
Version data entries
35 entries across 35 versions & 1 rubygems