Module: Glimmer::SWT::Properties

Included in:
Custom::Animation, Custom::Shape, ImageProxy, TransformProxy, WidgetProxy
Defined in:
lib/glimmer/swt/properties.rb

Instance Method Summary collapse

Instance Method Details

#attribute_getter(attribute_name) ⇒ Object



33
34
35
# File 'lib/glimmer/swt/properties.rb', line 33

def attribute_getter(attribute_name)
  "get#{normalized_attribute(attribute_name).camelcase(:upper)}"
end

#attribute_setter(attribute_name) ⇒ Object



29
30
31
# File 'lib/glimmer/swt/properties.rb', line 29

def attribute_setter(attribute_name)
  "set#{normalized_attribute(attribute_name).camelcase(:upper)}"
end

#normalized_attribute(attribute_name) ⇒ Object Also known as: ruby_attribute_getter



37
38
39
40
41
42
43
44
# File 'lib/glimmer/swt/properties.rb', line 37

def normalized_attribute(attribute_name)
  attribute_name = attribute_name.to_s if attribute_name.is_a?(Symbol)
  attribute_name = attribute_name.underscore unless attribute_name.downcase?
  attribute_name = attribute_name.sub(/^get_/, '') if attribute_name.start_with?('get_')
  attribute_name = attribute_name.sub(/^set_/, '') if attribute_name.start_with?('set_')
  attribute_name = attribute_name.sub(/=$/, '') if attribute_name.end_with?('=')
  attribute_name
end

#ruby_attribute_setter(attribute_name) ⇒ Object



25
26
27
# File 'lib/glimmer/swt/properties.rb', line 25

def ruby_attribute_setter(attribute_name)
  "#{normalized_attribute(attribute_name)}="
end