Sha256: bc738d803f46a34e8a30351797c103d8328834e8d18ea30d69e8078dd7afa5a0
Contents?: true
Size: 891 Bytes
Versions: 8
Compression:
Stored size: 891 Bytes
Contents
#!/usr/bin/ruby require "rubygems" require "flay" require "erubis" class Flay ## # Process erb and parse the result. Returns the sexp of the parsed # ruby. def process_erb file erb = File.read file ruby = Erubis.new(erb).src begin RubyParser.new.process(ruby, file) rescue => e warn ruby if option[:verbose] raise e end end class Erubis < ::Erubis::Eruby # :nodoc: BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/ def add_expr_literal(src, code) if code =~ BLOCK_EXPR src << '@output_buffer.append= ' << code else src << '@output_buffer.append=(' << code << ');' end end def add_expr_escaped(src, code) if code =~ BLOCK_EXPR src << "@output_buffer.safe_append= " << code else src << "@output_buffer.safe_append=(" << code << ");" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems