Module: DecoLite::Options
- Extended by:
- OptionsDefaultable, OptionsValidatable
- Defined in:
- lib/deco_lite/options.rb
Overview
Defines methods to create options.
Constant Summary
Constants included from OptionsDefaultable
DecoLite::OptionsDefaultable::DEFAULT_OPTIONS
Constants included from NamespaceOptionable
NamespaceOptionable::OPTION_NAMESPACE, NamespaceOptionable::OPTION_NAMESPACE_DEFAULT
Constants included from FieldsOptionable
FieldsOptionable::OPTION_FIELDS, FieldsOptionable::OPTION_FIELDS_DEFAULT, FieldsOptionable::OPTION_FIELDS_MERGE, FieldsOptionable::OPTION_FIELDS_STRICT, FieldsOptionable::OPTION_FIELDS_VALUES
Constants included from OptionsValidatable
DecoLite::OptionsValidatable::OPTIONS
Class Method Summary collapse
- .default ⇒ Object
- .new(**options) ⇒ Object
- .with_defaults(options, defaults: DEFAULT_OPTIONS) ⇒ Object
Methods included from OptionsValidatable
validate_option_fields!, validate_option_keys!, validate_option_namespace!, validate_options!, validate_options_present!
Class Method Details
.default ⇒ Object
36 37 38 |
# File 'lib/deco_lite/options.rb', line 36 def default with_defaults({}) end |
.new(**options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/deco_lite/options.rb', line 14 def new(**) immutable_struct_ex = ImmutableStructEx.new(**) do def merge? fields == OPTION_FIELDS_MERGE end def strict? fields == OPTION_FIELDS_STRICT end def namespace? namespace.present? || false end end options: immutable_struct_ex.to_h immutable_struct_ex end |
.with_defaults(options, defaults: DEFAULT_OPTIONS) ⇒ Object
32 33 34 |
# File 'lib/deco_lite/options.rb', line 32 def with_defaults(, defaults: DEFAULT_OPTIONS) new(**defaults.to_h.merge(.to_h)) end |