It looks like you want the #value method to get the integer value out of the enum instance.
enum AAA : Int32
Aaa
Bbb
Ccc
def foo
value.foo
end
end
struct Int32
def foo
"foo#{self}"
end
end
p AAA::Aaa.foo # => "foo0"
p AAA::Bbb.foo # => "foo1"
p AAA::Ccc.foo # => "foo2"
But as @asterite said, avoid adding new methods to built-in types, especially primitive types. That will cause issues down the line.