module Temple::Mixins::DefaultOptions
def default_options
def default_options @default_options ||= OptionHash.new(superclass.respond_to?(:default_options) ? superclass.default_options : nil) do |hash, key, deprecated| unless @option_validator_disabled if deprecated warn "Option #{key.inspect} is deprecated by #{self}" else # TODO: This will raise an exception in the future! # raise ArgumentError, "Option #{key.inspect} is not supported by #{self}" warn "Option #{key.inspect} is not supported by #{self}" end end end end
def define_deprecated_options(*opts)
def define_deprecated_options(*opts) if opts.last.respond_to?(:to_hash) hash = opts.pop.to_hash default_options.add_deprecated_keys(hash.keys) default_options.update(hash) end default_options.add_deprecated_keys(opts) end
def define_options(*opts)
def define_options(*opts) if opts.last.respond_to?(:to_hash) hash = opts.pop.to_hash default_options.add_valid_keys(hash.keys) default_options.update(hash) end default_options.add_valid_keys(opts) end
def disable_option_validator!
def disable_option_validator! @option_validator_disabled = true end
def set_default_options(opts)
def set_default_options(opts) default_options.update(opts) end