Closed novogrammer closed 12 years ago
Confusion where exactly? If you show me a good example, I will be happy to include this option.
The confusion occurs when I use an enum as global constant value,using FFI::Library.enum_value. And in case using unnamed enum, enum type can not be determined.
Here is an example.
//C code enum EnumA { EnumA_Default, EnumA_A, EnumA_B, }; enum EnumB { EnumB_A, EnumB_B, };
module Foo enum enum_a [ :default, 0, :a, 1, :b, 2 ]
enum enum_b [ :a, 0, :b, 1 ] end
Foo.enum_type(:enum_a)[:default] # => 0 Foo.enum_type(:enum_a)[:a] # => 1 Foo.enum_type(:enum_a)[:b] # => 2
Foo.enum_value(:default) # => 0 Foo.enum_value(:a) # => 0 Foo.enum_value(:b) # => 1
I close pull request. Because it is not for general use.
Short name may cause confusion.