3 ms·
I don't have an Elixir background (though I envy Elixir in many ways), but I absolutely utilize pattern matching in my Ruby code bases: - https://github.com/k
by ezekg 3y ago
I don't have an Elixir background (though I envy Elixir in many ways), but I absolutely utilize pattern matching in my Ruby code bases:
- https://github.com/keygen-sh/typed_params/blob/4e4982b7d2b263862c9a77296780c45c91c7e90f/lib/typed_params/formatters/jsonapi.rb#L72-L90 https://github.com/keygen-sh/typed_params/blob/4e4982b7d2b26...
- https://github.com/keygen-sh/typed_params/blob/4e4982b7d2b263862c9a77296780c45c91c7e90f/lib/typed_params/controller.rb#L116-L123 https://github.com/keygen-sh/typed_params/blob/4e4982b7d2b26...
- https://github.com/keygen-sh/keygen-api/blob/36cd61db143cc1c770cf0e4b8e9fb1be63993a3b/app/migrations/adjust_validity_for_validation_codes_migration.rb https://github.com/keygen-sh/keygen-api/blob/36cd61db143cc1c...
- https://github.com/keygen-sh/keygen-api/blob/36cd61db143cc1c770cf0e4b8e9fb1be63993a3b/app/policies/release_policy.rb#L10-L26 https://github.com/keygen-sh/keygen-api/blob/36cd61db143cc1c...
- https://github.com/keygen-sh/typed_params/blob/4e4982b7d2b263862c9a77296780c45c91c7e90f/spec/typed_params/parameterizer_spec.rb#L6-L32 https://github.com/keygen-sh/typed_params/blob/4e4982b7d2b26...
I love it. I want even more pattern matching too, like defp: https://bugs.ruby-lang.org/issues/19764 https://bugs.ruby-lang.org/issues/19764 (with original credit to https://zverok.space/blog/2023-05-05-ruby-types.html https://zverok.space/blog/2023-05-05-ruby-types.html).