Module: UIC::ElementBacked::ClassMethods

Included in:
Application::Behavior, Application::Presentation, Application::StateMachine
Defined in:
lib/ruic/interfaces.rb

Instance Method Summary collapse

Instance Method Details

#xmlattribute(name, getblock = nil, &setblock) ⇒ Object

Parameters:

  • name (String)

    the name of an XML attribute to expose.

  • getblock (Proc) (defaults to: nil)

    a proc to run



68
69
70
71
# File 'lib/ruic/interfaces.rb', line 68

def xmlattribute(name,getblock=nil,&setblock)
	define_method(name){ getblock ? getblock[@el[name]] : @el[name] }
	define_method("#{name}="){ |new_value| @el[name] = (setblock ? setblock[new_value] : new_value).to_s }
end