In a block of C++ code, I saw something like this:
enum {
a = 0,
b = (1U << 0),
c = (1U << 1),
d = (1U << 2)
}
To achieve the same thing in Ruby, would I have to do something like this?
d = "1U".bytes.inject { |x,y| (x<<8) | y } << 2
Or would I need to do something else to accomplish what the C++ code does?