PageRenderTime 29ms CodeModel.GetById 12ms app.highlight 12ms RepoModel.GetById 2ms app.codeStats 0ms

/lib/rails_best_practices/core_ext/erubis.rb

http://github.com/flyerhzm/rails_best_practices
Ruby | 35 lines | 26 code | 8 blank | 1 comment | 0 complexity | dd6f276511e5dfa18db2dccb069328b4 MD5 | raw file
 1# frozen_string_literal: true
 2
 3require 'erubis'
 4
 5module Erubis
 6  class OnlyRuby < Eruby
 7    def add_preamble(src); end
 8
 9    def add_text(src, text)
10      src << text.gsub(/[^\s;]/, '')
11    end
12
13    def add_stmt(src, code)
14      src << code
15      src << ';'
16    end
17
18    def add_expr_literal(src, code)
19      src << code
20      src << ';'
21    end
22
23    def add_expr_escaped(src, code)
24      src << code
25      src << ';'
26    end
27
28    def add_expr_debug(src, code)
29      src << code
30      src << ';'
31    end
32
33    def add_postamble(src); end
34  end
35end