Skip to content

Commit

Permalink
Make :include public on I18n::Backend::Simple
Browse files Browse the repository at this point in the history
Rationale: the I18n::Backend part of this library is designed to provide various modules that can be included into the I18n::Backend::Simple backend or other compatible backend implementations and thereby extend their functionality in an optional manner.

Thus, both code and documentation have been cluttered with lots of calls sending :include to the Simple backend class. It seems that we in fact treat sending include as a public API of the Simple backend class and therefor should make it public.
  • Loading branch information
Sven Fuchs committed Feb 14, 2011
1 parent 7ff8f9a commit 21d251b
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/i18n/backend/cache.rb
Expand Up @@ -4,7 +4,7 @@
# To enable caching you can simply include the Cache module to the Simple
# backend - or whatever other backend you are using:
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Cache)
# I18n::Backend::Simple.include(I18n::Backend::Cache)
#
# You will also need to set a cache store implementation that you want to use:
#
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/backend/fallbacks.rb
Expand Up @@ -6,7 +6,7 @@
# To enable locale fallbacks you can simply include the Fallbacks module to
# the Simple backend - or whatever other backend you are using:
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
# I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
module I18n
@@fallbacks = nil

Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/backend/gettext.rb
Expand Up @@ -6,7 +6,7 @@
# To use this you can simply include the module to the Simple backend - or
# whatever other backend you are using.
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Gettext)
# I18n::Backend::Simple.include(I18n::Backend::Gettext)
#
# Now you should be able to include your Gettext translation (*.po) files to
# the I18n.load_path so they're loaded to the backend and you can use them as
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/backend/interpolation_compiler.rb
Expand Up @@ -8,7 +8,7 @@
# To enable pre-compiled interpolations you can simply include the
# InterpolationCompiler module to the Simple backend:
#
# I18n::Backend::Simple.send(:include, I18n::Backend::InterpolationCompiler)
# I18n::Backend::Simple.include(I18n::Backend::InterpolationCompiler)
#
# Note that InterpolationCompiler does not yield meaningful results and consequently
# should not be used with Ruby 1.9 (YARV) but improves performance everywhere else
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/backend/memoize.rb
Expand Up @@ -3,7 +3,7 @@
#
# To enable it you can simply include the Memoize module to your backend:
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
# I18n::Backend::Simple.include(I18n::Backend::Memoize)
#
# Notice that it's the responsibility of the backend to define whenever the
# cache should be cleaned.
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/backend/metadata.rb
Expand Up @@ -12,7 +12,7 @@
# To enable translation metadata you can simply include the Metadata module
# into the Simple backend class - or whatever other backend you are using:
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Metadata)
# I18n::Backend::Simple.include(I18n::Backend::Metadata)
#
module I18n
module Backend
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/backend/pluralization.rb
Expand Up @@ -7,7 +7,7 @@
# Pluralization module to the Simple backend - or whatever other backend you
# are using.
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
# I18n::Backend::Simple.include(I18n::Backend::Pluralization)
#
# You also need to make sure to provide pluralization algorithms to the
# backend, i.e. include them to your I18n.load_path accordingly.
Expand Down
4 changes: 3 additions & 1 deletion lib/i18n/backend/simple.rb
Expand Up @@ -13,8 +13,10 @@ module Backend
# end
# end
#
# I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
# I18n::Backend::Simple.include(I18n::Backend::Pluralization)
class Simple
(class << self; self; end).class_eval { public :include }

module Implementation
include Base

Expand Down

0 comments on commit 21d251b

Please sign in to comment.