class Bookery::Config

Constants

META_METHODS

Attributes

language[R]

Public Class Methods

new(language, config) click to toggle source
# File lib/bookery/config.rb, line 7
def initialize(language, config)
  @language = language
  @config = config.symbolize_keys
end

Public Instance Methods

[](key) click to toggle source
# File lib/bookery/config.rb, line 12
def [](key)
  public_send(key)
end
method_missing(method, *args) click to toggle source
Calls superclass method
# File lib/bookery/config.rb, line 16
def method_missing(method, *args)
  if META_METHODS.include?(method)
    if value = lang_specific_value(method)
      value
    else
      config[method]
    end
  else
    super
  end
end

Private Instance Methods

config() click to toggle source
# File lib/bookery/config.rb, line 30
def config
  @config
end
lang_specific_value(key) click to toggle source
# File lib/bookery/config.rb, line 34
def lang_specific_value(key)
  if config[language.to_sym] and config[language.to_sym][key]
    config[language.to_sym][key]
  else
    nil
  end
end