Module: HakumiComponents::SelectionControl::Coercion
- Extended by:
- Coercion, T::Sig
- Included in:
- Coercion
- Defined in:
- app/components/hakumi_components/selection_control/coercion.rb
Constant Summary collapse
- FlatOptionHash =
T.type_alias { T::Hash[Types::HtmlKey, T.nilable(Types::ValidationPrimitive)] }
- FlatOptionTuple =
T.type_alias { [ T.nilable(Types::ValidationPrimitive), T.nilable(Types::ValidationPrimitive) ] }
- FlatOptionInput =
T.type_alias do T.any( Option, FlatOptionHash, FlatOptionTuple, HakumiComponents::Types::FormFieldScalar ) end
- GroupEntryHash =
T.type_alias do T::Hash[ Types::HtmlKey, T.nilable( T.any( Types::ValidationComparable, T::Array[FlatOptionInput] ) ) ] end
- EntryInput =
T.type_alias { T.any(Entry, FlatOptionInput, GroupEntryHash) }
- TreeNodeInput =
T.type_alias { HakumiComponents::SelectionControl::TreeNode::Input }
- ScalarInput =
T.type_alias do T.nilable(T.any(Types::FormFieldScalar, Date, Time, DateTime, ActiveSupport::TimeWithZone, ActiveSupport::SafeBuffer)) end
Instance Method Summary collapse
- #entries(options) ⇒ Object
- #options(options) ⇒ Object
- #scalar(value, fallback:) ⇒ Object
- #tree_nodes(options) ⇒ Object
Instance Method Details
#entries(options) ⇒ Object
53 54 55 |
# File 'app/components/hakumi_components/selection_control/coercion.rb', line 53 def entries() .filter_map { |option| normalize_entry(option) } end |
#options(options) ⇒ Object
48 49 50 |
# File 'app/components/hakumi_components/selection_control/coercion.rb', line 48 def () .filter_map { |option| normalize_option(option) } end |
#scalar(value, fallback:) ⇒ Object
43 44 45 |
# File 'app/components/hakumi_components/selection_control/coercion.rb', line 43 def scalar(value, fallback:) value.nil? ? fallback : value end |
#tree_nodes(options) ⇒ Object
58 59 60 |
# File 'app/components/hakumi_components/selection_control/coercion.rb', line 58 def tree_nodes() .filter_map { |option| normalize_tree_node(option) } end |