Module: I18nScopes::OptionAccessor::ClassMethods
- Defined in:
- lib/i18n_scopes/option_accessor.rb
Instance Method Summary collapse
-
#default_options ⇒ Object
default options.
-
#option_accessor(option, default = nil) ⇒ Object
creates accessor for options === Params: *
option
: the option key *default
: the default option.
Instance Method Details
#default_options ⇒ Object
default options
40 41 42 |
# File 'lib/i18n_scopes/option_accessor.rb', line 40 def @default_options ||= {} end |
#option_accessor(option, default = nil) ⇒ Object
creates accessor for options
Params:
-
option
: the option key -
default
: the default option
29 30 31 32 33 34 35 36 37 |
# File 'lib/i18n_scopes/option_accessor.rb', line 29 def option_accessor(option, default = nil) self.[option] = default define_method(option) do self.[option.to_sym] ||= default end define_method(:"#{option}=") do |value| self.[option.to_sym] = value end end |