Class: Event
- Inherits:
-
Object
- Object
- Event
- Defined in:
- lib/a-commons.rb
Overview
------------------------------------------
Event
------------------------------------------
Direct Known Subclasses
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #add_finalize_callback(_proc) ⇒ Object
- #add_result(_sender, _args = nil) ⇒ Object
- #break ⇒ Object
-
#initialize(_sender, _args = nil) ⇒ Event
constructor
A new instance of Event.
- #is_breaked? ⇒ Boolean
Constructor Details
#initialize(_sender, _args = nil) ⇒ Event
Returns a new instance of Event.
361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/a-commons.rb', line 361 def initialize(_sender, _args=nil) @breaked = false @sender = _sender @channel = '0' if _args _args.each do |key, value| #self.send(key, value) self.send(key.to_s+'=', value) if self.respond_to?(key.to_s) end end @time = Time.new @results = Array.new end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
358 359 360 |
# File 'lib/a-commons.rb', line 358 def channel @channel end |
#parent ⇒ Object
Returns the value of attribute parent.
357 358 359 |
# File 'lib/a-commons.rb', line 357 def parent @parent end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
360 361 362 |
# File 'lib/a-commons.rb', line 360 def results @results end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
356 357 358 |
# File 'lib/a-commons.rb', line 356 def sender @sender end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
359 360 361 |
# File 'lib/a-commons.rb', line 359 def time @time end |
Instance Method Details
#add_finalize_callback(_proc) ⇒ Object
375 376 377 |
# File 'lib/a-commons.rb', line 375 def add_finalize_callback(_proc) ObjectSpace.define_finalizer(self, _proc) end |
#add_result(_sender, _args = nil) ⇒ Object
379 380 381 382 383 384 385 386 387 |
# File 'lib/a-commons.rb', line 379 def add_result(_sender, _args=nil) if self.class::Result res = self.class::Result.new(_sender, _args) else res = Result.new(_sender, _args) end @results << res res end |
#break ⇒ Object
393 394 395 |
# File 'lib/a-commons.rb', line 393 def break @breaked = true end |
#is_breaked? ⇒ Boolean
389 390 391 |
# File 'lib/a-commons.rb', line 389 def is_breaked? @breaked end |