module Translatomatic::Util

Utility functions, used internally

Public Class Methods

included(klass) click to toggle source

@!visibility private

# File lib/translatomatic/util.rb, line 5
def self.included(klass)
  klass.extend(ClassMethods)
end

Private Instance Methods

build_locale(tag) click to toggle source
# File lib/translatomatic/util.rb, line 31
def build_locale(tag)
  Translatomatic::Locale.parse(tag)
end
build_text(string, locale, options = {}) click to toggle source
# File lib/translatomatic/util.rb, line 35
def build_text(string, locale, options = {})
  return nil if string.nil?
  Translatomatic::Text.new(string, locale, options)
end
hashify(list, key_mapping = proc { |i| i.to_s }) click to toggle source
# File lib/translatomatic/util.rb, line 40
def hashify(list, key_mapping = proc { |i| i.to_s })
  hash = {}
  list.each do |i|
    key = key_mapping.call(i)
    hash[key] = i
  end
  hash
end
log() click to toggle source
# File lib/translatomatic/util.rb, line 27
def log
  Translatomatic.logger
end