Class: Event
- Inherits:
-
Object
- Object
- Event
- Defined in:
- lib/a-commons.rb
Overview
------------------------------------------
Event
------------------------------------------
Direct Known Subclasses
Defined Under Namespace
Classes: Result
Constant Summary collapse
- FLAG_ERROR =
'E'
- FLAG_DEFAULT =
'0'
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#flag ⇒ Object
is used to give a state to event.
-
#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.
621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/a-commons.rb', line 621 def initialize(_sender, _args=nil) @breaked = false @sender = _sender @channel = '0' @flag= FLAG_DEFAULT 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.
615 616 617 |
# File 'lib/a-commons.rb', line 615 def channel @channel end |
#flag ⇒ Object
is used to give a state to event
617 618 619 |
# File 'lib/a-commons.rb', line 617 def flag @flag end |
#parent ⇒ Object
Returns the value of attribute parent.
614 615 616 |
# File 'lib/a-commons.rb', line 614 def parent @parent end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
618 619 620 |
# File 'lib/a-commons.rb', line 618 def results @results end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
613 614 615 |
# File 'lib/a-commons.rb', line 613 def sender @sender end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
616 617 618 |
# File 'lib/a-commons.rb', line 616 def time @time end |
Instance Method Details
#add_finalize_callback(_proc) ⇒ Object
636 637 638 |
# File 'lib/a-commons.rb', line 636 def add_finalize_callback(_proc) ObjectSpace.define_finalizer(self, _proc) end |
#add_result(_sender, _args = nil) ⇒ Object
640 641 642 643 644 645 646 647 648 |
# File 'lib/a-commons.rb', line 640 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
654 655 656 |
# File 'lib/a-commons.rb', line 654 def break @breaked = true end |
#is_breaked? ⇒ Boolean
650 651 652 |
# File 'lib/a-commons.rb', line 650 def is_breaked? @breaked end |