Class: JObject

Inherits:
Object show all
Defined in:
lib/clevic/swing/extensions.rb

Instance Method Summary collapse

Instance Method Details

#const_lookup(integer, *filter_block) ⇒ Object

filter_block returns true if the event is to be constantified, false otherwise. the name of the constant will be passed to the block



128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/clevic/swing/extensions.rb', line 128

def const_lookup( integer, *filter_block )
  self.class.constants.select do |constant_name|
    if eval( "self.class::#{constant_name}" ) == integer
      if block_given?
        yield constant_name
      else
        true
      end
    else
      false
    end
  end
end