Module: HasManyTranslations::Configuration
- Included in:
- HasManyTranslations
- Defined in:
- lib/has_many_translations/configuration.rb
Class Method Summary collapse
-
.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. -
.options ⇒ Object
Simply stores a hash of options given to the
configure
block.
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!(/\=$/, '') [method.to_sym] = args.first else .fetch(method.to_sym, super) end end |
.options ⇒ Object
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 ||= {} end |
Instance Method Details
#configure {|Configuration| ... } ⇒ Object
4 5 6 |
# File 'lib/has_many_translations/configuration.rb', line 4 def configure yield Configuration end |