module ActionMailer::LocalizedPreview

Constants

VERSION

Public Instance Methods

method_missing(localized_method_name, *args) click to toggle source
# File lib/action_mailer/localized_preview.rb, line 23
def method_missing(localized_method_name, *args)
  localized_method_name.to_s =~ /(.*)_([^_]+)$/
  method_name, locale = $1, $2.to_sym
  current_locale = I18n.locale
  begin
    I18n.locale = locale
    case self.method(method_name).arity
    when 0
      public_send(method_name)
    when 1
      public_send(method_name, locale)
    else
      raise ArgumentError, "wrong number of arguments (expected 0 or 1)"
    end
  ensure
    I18n.locale = current_locale
  end
end