Q:

Why can I access constants inside an array in Ruby?

Say I have:
class MyClass
  MY_ENUM = [MY_VALUE_1 = 'value1', MY_VALUE_2 = 'value2']
end

Something like this is possible:
p MyClass::MY_VALUE_1 #=> "value1"

Why? Isn't MY_VALUE1 and MY_VALUE_2 constant scope inside the []?

A:

You can access the nested constant MY_VALUE_1 because it is in the same scope as the outer constant MY_ENUM: Both constants are in the scope of class MyClass.
You expected the [...] construct to define a new scope, but it does not.  In Ruby, only three things define a new scope:

Defining a class using class SomeName
Defining a module using module SomeName
Defining a function using def some_name

