Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby -wKU
puts RUBY_DESCRIPTION
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
require 'i18n'
require 'benchmark'
require 'yaml'
str = "This is a custom blank message for {{model}}: {{attribute}}"
#!/usr/bin/env ruby -KU
$:.unshift(File.join(File.dirname(__FILE__), "../lib")).unshift('lib')
require 'i18n'
require 'benchmark'
f = I18n::Backend::Fast.new
I18n.backend = f
interpolation = 'abc {{a}}, {{b}}'
module ChainSetup
def setup
super
first = I18n::Backend::Simple.new
# first.store_translations(:en, translations)
I18n.backend = I18n::Backend::Chain.new(first, I18n.backend)
end
def test_using_chain_backend
assert_equal I18n::Backend::Chain, I18n.backend.class
$:.unshift "lib"
require 'i18n'
require "benchmark"
def with_fast?; defined?(I18n::Backend::Fast); end
str = 'abc {{a}}, {{b}}'
f = I18n::Backend::Fast.new if with_fast?
From d599036f67b36203b1e98ece6b4635a1dd588204 Mon Sep 17 00:00:00 2001
From: thedarkone <nobody>
Date: Thu, 12 Feb 2009 19:35:14 +0100
Subject: [PATCH] Port fast reloadable templates from rails-dev-boost.
---
actionmailer/test/abstract_unit.rb | 1 +
actionmailer/test/mail_service_test.rb | 2 +-
actionpack/lib/action_controller/rescue.rb | 2 +-
actionpack/lib/action_view.rb | 1 +
def setup
@compiled_templates = ActionView::Base::CompiledTemplates
# first, if we are running the whole test suite with ReloadableTemplates
# try to undef all the methods through ReloadableTemplate's interfaces
unless ActionView::Base.cache_template_loading?
ActionController::Base.view_paths.each do |view_path|
view_path.paths.values.uniq!.each do |reloadable_template|
reloadable_template.undef_my_compiled_methods!
end