Module: Temple::Mixins::ClassOptions
- Included in:
- Template
- Defined in:
- lib/temple/mixins/options.rb
Instance Method Summary collapse
- #default_options ⇒ Object
- #define_deprecated_options(*opts) ⇒ Object
- #define_options(*opts) ⇒ Object
- #disable_option_validator! ⇒ Object
- #options ⇒ Object
- #set_default_options(opts) ⇒ Object
- #set_options(opts) ⇒ Object
Instance Method Details
#default_options ⇒ Object
11 12 13 14 |
# File 'lib/temple/mixins/options.rb', line 11 def warn 'default_options has been deprecated, use options' end |
#define_deprecated_options(*opts) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/temple/mixins/options.rb', line 36 def (*opts) if opts.last.respond_to?(:to_hash) hash = opts.pop.to_hash .add_deprecated_keys(hash.keys) .update(hash) end .add_deprecated_keys(opts) end |
#define_options(*opts) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/temple/mixins/options.rb', line 27 def (*opts) if opts.last.respond_to?(:to_hash) hash = opts.pop.to_hash .add_valid_keys(hash.keys) .update(hash) end .add_valid_keys(opts) end |
#disable_option_validator! ⇒ Object
45 46 47 |
# File 'lib/temple/mixins/options.rb', line 45 def disable_option_validator! @option_validator_disabled = true end |
#options ⇒ Object
20 21 22 23 24 25 |
# File 'lib/temple/mixins/options.rb', line 20 def @options ||= OptionMap.new(superclass.respond_to?(:options) ? superclass. : nil) do |hash, key, what| warn "#{self}: Option #{key.inspect} is #{what}" unless @option_validator_disabled end end |
#set_default_options(opts) ⇒ Object
6 7 8 9 |
# File 'lib/temple/mixins/options.rb', line 6 def (opts) warn 'set_default_options has been deprecated, use set_options' (opts) end |
#set_options(opts) ⇒ Object
16 17 18 |
# File 'lib/temple/mixins/options.rb', line 16 def (opts) .update(opts) end |