lib/glimmer/swt/style_constantizable.rb in glimmer-dsl-swt-4.17.2.3 vs lib/glimmer/swt/style_constantizable.rb in glimmer-dsl-swt-4.17.2.4
- old
+ new
@@ -126,17 +126,18 @@
# Deconstructs a style integer into symbols
# Useful for debugging
def deconstruct(integer)
constant_source_class.constants.reduce([]) do |found, c|
constant_value = constant_source_class.const_get(c) rescue -1
- is_found = constant_value.is_a?(Integer) && (integer & constant_value) == integer
+ is_found = constant_value.is_a?(Integer) && (integer & constant_value) == constant_value
is_found ? found += [c] : found
end
end
# Reverse engineer a style integer into a symbol
# Useful for debugging
def reverse_lookup(integer)
+ # TODO support looking up compound style mixes
constant_source_class.constants.reduce([]) do |found, c|
constant_value = constant_source_class.const_get(c) rescue -1
is_found = constant_value.is_a?(Integer) && integer == constant_value
is_found ? found += [c] : found
end