Skip to content

Commit

Permalink
Merge pull request #234 from carlosantoniodasilva/ca-fix-warnings
Browse files Browse the repository at this point in the history
Fix instance variable not defined warnings due to added deprecations
  • Loading branch information
tigrish committed Dec 15, 2013
2 parents 12aa0f0 + 3d03935 commit 8fc94e7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def default_exception_handler(exception, locale, key, options)
end

def handle_enforce_available_locales_deprecation
if config.enforce_available_locales.nil? && !@unenforced_available_locales_deprecation
$stderr.puts "[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message."
if config.enforce_available_locales.nil? && !defined?(@unenforced_available_locales_deprecation)
$stderr.puts "[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message."
@unenforced_available_locales_deprecation = true
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def call(exception, locale, key, options)
# TODO: this block is to be replaced by `exception.message` when
# rescue_format is removed
if options[:rescue_format] == :html
if @rescue_format_deprecation
if !defined?(@rescue_format_deprecation)
$stderr.puts "[DEPRECATED] I18n's :recue_format option will be removed from a future release. All exception messages will be plain text. If you need the exception handler to return an html format please set or pass a custom exception handler."
@rescue_format_deprecation = true
end
Expand Down
2 changes: 1 addition & 1 deletion test/i18n/exceptions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class I18nExceptionsTest < Test::Unit::TestCase
def test_invalid_locale_stores_locale
force_invalid_locale
rescue I18n::ArgumentError => e
rescue I18n::ArgumentError => exception
assert_nil exception.locale
end

Expand Down

0 comments on commit 8fc94e7

Please sign in to comment.