Sha256: 5e5b25b1eac598ad5c3d2439b33dbf40233512c2fdd85228963665b0ea373915

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

class RSwt
  class << self
    # Gets SWT constants as if calling SWT::CONSTANT where constant is
    # passed in as a lower case symbol
    def [](*symbols)
      symbols.compact.reduce(0) { |output, symbol| output | constant(symbol) }
    end

    def constant(symbol)
      return symbol if symbol.is_a?(Integer)
      swt_constant_symbol = symbol.to_s.upcase.to_sym
      org.eclipse.swt.SWT.const_get(swt_constant_symbol)
    rescue
      swt_constant_symbol = org.eclipse.swt.SWT.constants.find {|c| c.to_s.upcase == swt_constant_symbol.to_s}
      org.eclipse.swt.SWT.const_get(swt_constant_symbol)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glimmer-0.3.5 lib/command_handlers/models/r_swt.rb