Class: SelectableAttr::Enum
- Inherits:
-
Object
- Object
- SelectableAttr::Enum
- Defined in:
- lib/selectable_attr_i18n.rb
Defined Under Namespace
Classes: Entry
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.i18n_export ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/selectable_attr_i18n.rb', line 4 def self.i18n_export result = {} instances.each do |instance| unless instance.i18n_scope # puts "no i18n_scope of #{instance.inspect}" next end paths = instance.i18n_scope.dup current = result paths.each do |path| current = current[path.to_s] ||= {} end instance.entries.each do |entry| current[entry.key.to_s] = entry.name end end result end |
Instance Method Details
#i18n_scope(*path) ⇒ Object
23 24 25 26 |
# File 'lib/selectable_attr_i18n.rb', line 23 def i18n_scope(*path) @i18n_scope = path unless path.empty? @i18n_scope end |