module Iup::AttributeReference
Defines method for getting/setting attribute values.
Public Instance Methods
attribute_reference(name, target, val=nil)
click to toggle source
Method used to get or set the value of attributes.
- when retrieving
-
simply return the attribute with given name.
- when setting
-
an attribute reference can be defined by its string name or directly as an instance of target class
# File lib/wrapped/attribute-reference.rb, line 10 def attribute_reference name, target, val=nil case val when NilClass IupLib.IupGetAttribute(@handle, name).first when String IupLib.IupSetAttribute @handle, name, val when target image_name = IupLib.IupGetName(name).first if image_name.nil? or image_name.empty? image_name = SecureRandom.uuid val.assign_handle image_name end IupLib.IupSetAttribute @handle, name, image_name end end