Class: Mack::Localization::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/mack-localization/configuration.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/mack-localization/configuration.rb', line 43

def method_missing(sym, *args)
  supported_settings = [:base_language, :supported_languages, :char_encoding, :dynamic_translation, :content_expiry,
                        :base_language=, :supported_languages=, :char_encoding=, :dynamic_translation=, :content_expiry=]
  if supported_settings.include?(sym)
    configatron.mack.localization.send(sym, *args)
  end
end

Instance Method Details

#base_directoryObject



37
38
39
40
41
# File 'lib/mack-localization/configuration.rb', line 37

def base_directory
  arr = configatron.mack.localization.base_directory
  arr = [Mack::Paths.app('lang')] if arr.is_a?(Configatron::Store) and !arr.is_a?(Array)
  return (arr.size == 1) ? arr[0] : arr
end

#base_directory=(path) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/mack-localization/configuration.rb', line 29

def base_directory= (path)
  arr = configatron.mack.localization.base_directory
  arr = [] if arr.is_a?(Configatron::Store) and !arr.is_a?(Array)
  arr << path
  arr.uniq!
  configatron.mack.localization.base_directory = arr
end