Why this downcase here is needed?
It is hard to imagine why we should support `:aSc`. It cost us performance and I think it isn't worth it at all.

And even if we have to support downcase this code doesn't look optimised: produce 2 intermediate arrays.
This variant should be faster:

``` ruby
h.each do |_, value|
  raise ... unless VALID_DIRECTIONS.incude?(value.downcase)
end
```