Class: Rack::I18nRoutes::AliasMappingUpdater
- Inherits:
-
Object
- Object
- Rack::I18nRoutes::AliasMappingUpdater
- Defined in:
- lib/rack/i18n_routes/alias_mapping_updater.rb
Overview
An AliasMapping that updates on every #map
call.
To be used as a mapping object for Rack::I18nRoutes when the aliases needed by AliasMapping cannot be statically generated at middleware buildtime.
Instance Method Summary collapse
- #alias_mapping ⇒ Object private
-
#initialize(new_aliases_fn, opts = {}) ⇒ AliasMappingUpdater
constructor
Creates a new alias-based Mapping object that updates its aliases on every path normalization.
- #map(path) ⇒ Object private
- #path_analysis(path, replacement_language = :default) ⇒ Object private
- #translate_into(path, language) ⇒ Object private
Constructor Details
#initialize(new_aliases_fn, opts = {}) ⇒ AliasMappingUpdater
Creates a new alias-based Mapping object that updates its aliases on every path normalization.
52 53 54 55 |
# File 'lib/rack/i18n_routes/alias_mapping_updater.rb', line 52 def initialize(new_aliases_fn, opts = {}) @new_aliases_fn = new_aliases_fn @opts = opts end |
Instance Method Details
#alias_mapping ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
89 90 91 92 93 94 |
# File 'lib/rack/i18n_routes/alias_mapping_updater.rb', line 89 def alias_mapping aliases = @new_aliases_fn[] mapping = Rack::I18nRoutes::AliasMapping.new(aliases, @opts) return mapping end |
#map(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'lib/rack/i18n_routes/alias_mapping_updater.rb', line 63 def map(path) alias_mapping.map(path) end |
#path_analysis(path, replacement_language = :default) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
83 84 85 |
# File 'lib/rack/i18n_routes/alias_mapping_updater.rb', line 83 def path_analysis(path, replacement_language = :default) alias_mapping.analysis(path, replacement_language) end |
#translate_into(path, language) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 |
# File 'lib/rack/i18n_routes/alias_mapping_updater.rb', line 73 def translate_into(path, language) alias_mapping.translated_into(path, language) end |