Class: Iup::Timer
- Inherits:
-
Object
- Object
- Iup::Timer
- Extended by:
- AttributeBuilders
- Includes:
- CallbackSetter
- Defined in:
- lib/wrapped/timer.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
-
#action_cb(callback) ⇒ Object
Called when the time is up.
-
#destroy ⇒ Object
must be called when Timer is finished with.
-
#initialize(&block) ⇒ Timer
constructor
A new instance of Timer.
Methods included from AttributeBuilders
define_attribute, define_id_attribute, define_id_readonly, define_id_writeonly, define_property_attribute, define_property_writeonly, define_readonly, define_writeonly
Methods included from CallbackSetter
Constructor Details
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
7 8 9 |
# File 'lib/wrapped/timer.rb', line 7 def handle @handle end |
Instance Method Details
#action_cb(callback) ⇒ Object
Called when the time is up. Return CLOSE to end application.
31 32 33 34 35 36 37 38 39 |
# File 'lib/wrapped/timer.rb', line 31 def action_cb callback unless callback.arity.zero? raise ArgumentError, 'action_cb must take 0 arguments' end cb = Proc.new do |ih| callback.call end define_callback cb, 'ACTION_CB', :plain end |
#destroy ⇒ Object
must be called when Timer is finished with
17 18 19 |
# File 'lib/wrapped/timer.rb', line 17 def destroy IupLib.IupDestroy @handle end |