lib/lit/cache.rb
def parse_value(v, locale)
        new_value = nil
        case v
          when Symbol then
            lk = Lit::LocalizationKey.where(:localization_key=>v.to_s).first
            if lk
              loca = Lit::Localization.where(:locale_id=>locale.id).
                          where(:localization_key_id=>lk.id).first
              new_value = loca.get_value if loca and loca.get_value.present?
            end
          when String then
            new_value = v
          when Hash then
            new_value = nil
          when Proc then
            new_value = nil # was v.call - requires more love
          else
            new_value = v.to_s
        end
        new_value
      end
## checks parameter type and returns value basing on it
## symbols are beeing looked up in db
## string are returned directly
## procs are beeing called (once)
## hashes are converted do string (for now)
checks parameter type and returns value basing on it
symbols are beeing looked up in db
string are returned directly
procs are beeing called (once)
hashes are converted do string (for now)
checks parameter type and returns value basing on it symbols are beeing looked up in db string are returned directly procs are beeing called ( once ) hashes are converted do string ( for now )
def parse_value(v, locale)
        new_value = nil
        case v
          when Symbol then
            lk = Lit::LocalizationKey.where(:localization_key=>v.to_s).first
            if lk
              loca = Lit::Localization.where(:locale_id=>locale.id).
                          where(:localization_key_id=>lk.id).first
              new_value = loca.get_value if loca and loca.get_value.present?
            end
          when String then
            new_value = v
          when Hash then
            new_value = nil
          when Proc then
            new_value = nil 
          else
            new_value = v.to_s
        end
        new_value
      end
def parse_value ( v , locale ) new_value = nil case v when Symbol then lk = Lit :: LocalizationKey . where ( :localization_key => v . to_s ) . first if lk loca = Lit :: Localization . where ( :locale_id => locale . id ) . where ( :localization_key_id => lk . id ) . first new_value = loca . get_value if loca and loca . get_value . present? end when String then new_value = v when Hash then new_value = nil when Proc then new_value = nil else new_value = v . to_s end new_value end
checks parameter type and returns value basing on it
symbols are beeing looked up in db
string are returned directly
procs are beeing called (once)
hashes are converted do string (for now)
checks parameter type and returns value basing on it symbols are beeing looked up in db string are returned directly procs are beeing called ( once ) hashes are converted do string ( for now )
# was v.call - requires more love
v
locale