Module: Card::Set::I18nScope
- Included in:
- Card::Set
- Defined in:
- lib/card/set/i18n_scope.rb
Overview
Adapt Internationalization(i18n) scope handling to infer mod prefixes.
Instance Method Summary collapse
-
#mod_name(backtrace) ⇒ Object
extract the mod name from the path of a set’s tmp file.
-
#scope(backtrace) ⇒ Object
return scope for I18n.
Instance Method Details
#mod_name(backtrace) ⇒ Object
extract the mod name from the path of a set’s tmp file
17 18 19 20 |
# File 'lib/card/set/i18n_scope.rb', line 17 def mod_name backtrace parts = path_parts backtrace mod_from_parts parts, path_set_index(parts) end |
#scope(backtrace) ⇒ Object
return scope for I18n
8 9 10 11 12 13 14 |
# File 'lib/card/set/i18n_scope.rb', line 8 def scope backtrace return "lib" unless (parts = path_parts backtrace) index = path_set_index parts mod = mod_from_parts parts, index mod || "lib" end |