Module: HasManyTranslations::Configuration

Included in:
HasManyTranslations
Defined in:
lib/has_many_translations/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.method_missing(symbol, *args) ⇒ Object

If given a setter method name, will assign the first argument to the options hash with the method name (sans “=”) as the key. If given a getter method name, will attempt to a value from the options hash for that key. If the key doesn’t exist, defers to super.



17
18
19
20
21
22
23
# File 'lib/has_many_translations/configuration.rb', line 17

def method_missing(symbol, *args)
  if (method = symbol.to_s).sub!(/\=$/, '')
    options[method.to_sym] = args.first
  else
    options.fetch(method.to_sym, super)
  end
end

.optionsObject

Simply stores a hash of options given to the configure block.



10
11
12
# File 'lib/has_many_translations/configuration.rb', line 10

def options
  @options ||= {}
end

Instance Method Details

#configure {|Configuration| ... } ⇒ Object

Yields:



4
5
6
# File 'lib/has_many_translations/configuration.rb', line 4

def configure
  yield Configuration
end