Module: Iup::AttributeReference
- Included in:
- Dialog, ImageAttributes, Tabs
- Defined in:
- lib/wrapped/attribute-reference.rb
Overview
Defines method for getting/setting attribute values.
Instance Method Summary collapse
-
#attribute_reference(name, target, val = nil) ⇒ Object
Method used to get or set the value of attributes.
Instance Method Details
#attribute_reference(name, target, val = nil) ⇒ Object
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
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 target_name = IupLib.IupGetName(name).first if target_name.nil? or target_name.empty? target_name = SecureRandom.uuid val.assign_handle(target_name) end IupLib.IupSetAttribute(@handle, name, target_name) end end |