constants/when_constant_in_called_method.rb
tests/_examples/constants/when_constant_in_called_method.rb in the metorex repository.
module Kinds
class << self
def of(value)
case value
when Array then :array
else :other
end
end
end
end
class Host
Array = :shadow
end
Host.class_exec do
p Kinds.of([1])
end
Output:
:array