lib/wx/core/enum.rb in wxruby3-0.9.8 vs lib/wx/core/enum.rb in wxruby3-1.0.1

- old
+ new

@@ -46,10 +46,26 @@ def hash @value.hash end + def bitmask_to_s + return '' if to_i == 0 + enums = [] + mask = to_i + self.class.values.each_value do |enum| + if enum != 0 && mask.allbits?(enum) + enums << enum.to_s + mask &= ~enum + break if mask == 0 + end + end + enums << mask.to_s if mask != 0 + enums.join('|') + end + private :bitmask_to_s + def to_s - to_i.to_s + self.class.values.has_key?(to_i) ? "#{self.class.name}::#{self.class.names_by_value[self]}" : bitmask_to_s end end