lib/lit/cache.rb
# this comes directly from copycopter.
this comes directly from copycopter.
this comes directly from copycopter .
def export
      keys = {}
      reset
      db_localizations = {}
      Lit::Localization.find_each do |l|
        db_localizations[l.full_key] = l.get_value
      end
      db_localizations.sort.each do |(l_key, value)|
        current = keys
        yaml_keys = l_key.split('.')
        0.upto(yaml_keys.size - 2) do |i|
          key = yaml_keys[i]
          unless current[key].class == Hash
            current[key] = {}
          end
          current = current[key]
        end
        current[yaml_keys.last] = value
      end
      keys.to_yaml
    end
def export keys = { } reset db_localizations = { } Lit :: Localization . find_each do | l | db_localizations [ l . full_key ] = l . get_value end db_localizations . sort . each do | ( l_key , value ) | current = keys yaml_keys = l_key . split ( '.' ) 0 . upto ( yaml_keys . size - 2 ) do | i | key = yaml_keys [ i ] unless current [ key ] . class == Hash current [ key ] = { } end current = current [ key ] end current [ yaml_keys . last ] = value end keys . to_yaml end
this comes directly from copycopter.
this comes directly from copycopter .
# Overwrite en.key with en.sub.key