Class: Crystalball::Rails::MapGenerator::I18nStrategy
- Inherits:
-
Object
- Object
- Crystalball::Rails::MapGenerator::I18nStrategy
- Defined in:
- lib/crystalball/rails/map_generator/i18n_strategy.rb,
lib/crystalball/rails/map_generator/i18n_strategy/simple_patch.rb
Overview
Map generator strategy to build map of locale files used by an example.
Defined Under Namespace
Modules: SimplePatch
Instance Attribute Summary
Attributes included from MapGenerator::Helpers::PathFilter
Class Method Summary collapse
-
.locale_files ⇒ Array<String>
List of locale files affected by current example.
-
.reset_locale_files ⇒ Object
Reset cached list of locale files.
Instance Method Summary collapse
- #after_register ⇒ Object
- #before_finalize ⇒ Object
-
#call(example_group_map, _) {|example_group_map| ... } ⇒ Object
Adds to the example group map the locale files used by the example.
Methods included from MapGenerator::Helpers::PathFilter
Methods included from MapGenerator::BaseStrategy
Class Method Details
.locale_files ⇒ Array<String>
List of locale files affected by current example
19 20 21 |
# File 'lib/crystalball/rails/map_generator/i18n_strategy.rb', line 19 def locale_files @locale_files ||= [] end |
.reset_locale_files ⇒ Object
Reset cached list of locale files
24 25 26 |
# File 'lib/crystalball/rails/map_generator/i18n_strategy.rb', line 24 def reset_locale_files @locale_files = [] end |
Instance Method Details
#after_register ⇒ Object
29 30 31 |
# File 'lib/crystalball/rails/map_generator/i18n_strategy.rb', line 29 def after_register SimplePatch.apply! end |
#before_finalize ⇒ Object
33 34 35 |
# File 'lib/crystalball/rails/map_generator/i18n_strategy.rb', line 33 def before_finalize SimplePatch.revert! end |
#call(example_group_map, _) {|example_group_map| ... } ⇒ Object
Adds to the example group map the locale files used by the example
39 40 41 42 43 |
# File 'lib/crystalball/rails/map_generator/i18n_strategy.rb', line 39 def call(example_group_map, _) self.class.reset_locale_files yield example_group_map example_group_map.push(*filter(self.class.locale_files.compact)) end |