Class: HakumiComponents::Table::Configs::RowDrag
- Inherits:
-
Object
- Object
- HakumiComponents::Table::Configs::RowDrag
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/table/configs.rb
Constant Summary collapse
- Input =
T.type_alias { T.nilable(T.any(T::Boolean, Types::HtmlKey, InputHash, HakumiComponents::Table::Configs::RowDrag)) }
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(enabled:, handle:) ⇒ RowDrag
constructor
A new instance of RowDrag.
Constructor Details
#initialize(enabled:, handle:) ⇒ RowDrag
Returns a new instance of RowDrag.
253 254 255 256 |
# File 'app/components/hakumi_components/table/configs.rb', line 253 def initialize(enabled:, handle:) @enabled = T.let(enabled, T::Boolean) @handle = T.let(handle, T::Boolean) end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
259 260 261 |
# File 'app/components/hakumi_components/table/configs.rb', line 259 def enabled @enabled end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
259 260 261 |
# File 'app/components/hakumi_components/table/configs.rb', line 259 def handle @handle end |
Class Method Details
.coerce(value) ⇒ Object
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'app/components/hakumi_components/table/configs.rb', line 262 def self.coerce(value) return nil if value.nil? || value == false return value if value.is_a?(HakumiComponents::Table::Configs::RowDrag) case value when true new(enabled: true, handle: false) when :handle new(enabled: true, handle: true) when Hash normalized = value.deep_symbolize_keys new( enabled: normalized.fetch(:enabled, true) == true, handle: normalized.fetch(:handle, false) == true ) end end |