Sha256: 703fbd45ed5206149324e3b79b9a81b4cb12f5ddad38688c1ef276c18c7d930d

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

require "#{File.dirname(__FILE__)}/through_ryoku"

module I18nTranslationGeneratorModule
  class ErbExecuter
    def exec_erb(filename)
      begin
#         ERB.new(File.read(f)).result
        (m = Module.new).module_eval <<-EOS
          class Executer
            extend ERB::DefMethod
            include ActionView::Helpers::TranslationHelper
            include ThroughRyoku
            nil.class_eval do
              def method_missing(method, *args, &block); nil; end
            end
            def_erb_method 'execute', '#{filename}'
          end
        EOS
        m.const_get('Executer').new.execute { }
        nil.class_eval do
          undef :method_missing
        end
      rescue => e
        p e
        # do nothing
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amatsuda-i18n_generators-0.3.0 generators/i18n_translation/lib/erb_executer.rb
amatsuda-i18n_generators-0.3.1 generators/i18n_translation/lib/erb_executer.rb