Sha256: 6ba6572a820a48be660f7ca8a0c254b6a46964a92434121f4247c8dfd91b30d7
Contents?: true
Size: 766 Bytes
Versions: 3
Compression:
Stored size: 766 Bytes
Contents
module Cubism class Preprocessor def initialize(source:, view_context:) match_data = /<%=\s+cubicle_for.+\|.+\|\s+%>/.match(source) start_pos = match_data&.end(0) || 0 @source = source[start_pos..] @view_context = view_context end def process begin do_parse rescue NameError # we ignore any name errors from unset instance variables or local assigns here end @source end private def do_parse ActionView::Template::Handlers::ERB::Erubi.new(@source).evaluate(@view_context) rescue SyntaxError end_at_end = /(<%\s+end\s+%>)\z/.match(@source) @source = end_at_end ? @source[..-(end_at_end[0].length + 1)] : @source[..-2] do_parse end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cubism-0.1.0.pre12 | lib/cubism/preprocessor.rb~ |
cubism-0.1.0.pre11 | lib/cubism/preprocessor.rb~ |
cubism-0.1.0.pre10 | lib/cubism/preprocessor.rb |