module UIC::ElementBacked::ClassMethods
Public Instance Methods
xmlattribute(name,getblock=nil,&setblock)
click to toggle source
Add methods to instances of the class which gets/sets from an XML attribute. @param name [String] the name of an XML attribute to expose. @param getblock [Proc] a proc to run to fetch the value.
# File lib/ruic/interfaces.rb, line 107 def xmlattribute(name,getblock=nil,&setblock) define_method(name){ getblock ? getblock[@el[name],self] : @el[name] } define_method("#{name}="){ |new_value| @el[name] = (setblock ? setblock[new_value,self] : new_value).to_s } end