Module: ToyAdt::DeconstructableSorbetStruct
- Extended by:
- T::Sig
- Defined in:
- lib/toy_adt/deconstructable_sorbet_struct.rb
Instance Method Summary collapse
Instance Method Details
#deconstruct ⇒ Object
9 10 11 |
# File 'lib/toy_adt/deconstructable_sorbet_struct.rb', line 9 def deconstruct properties.map { send(_1) } end |
#deconstruct_keys(keys) ⇒ Object
18 19 20 21 22 |
# File 'lib/toy_adt/deconstructable_sorbet_struct.rb', line 18 def deconstruct_keys(keys) return properties.to_h { |k| [k, send(k)] } if keys.nil? || keys.empty? (properties & keys).to_h { |k| [k, send(k)] } end |
#properties ⇒ Object
25 26 27 |
# File 'lib/toy_adt/deconstructable_sorbet_struct.rb', line 25 def properties self.class.props.keys end |