Class: Event

Inherits:
Object
  • Object
show all
Defined in:
lib/a-commons.rb

Overview

------------------------------------------

Event

------------------------------------------

Direct Known Subclasses

ArcadiaEvent

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_sender, _args = nil) ⇒ Event

Returns a new instance of Event.



271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/a-commons.rb', line 271

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+'=', value)
    end
  end
  @time = Time.new
  @results = Array.new
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



268
269
270
# File 'lib/a-commons.rb', line 268

def channel
  @channel
end

#parentObject

Returns the value of attribute parent.



267
268
269
# File 'lib/a-commons.rb', line 267

def parent
  @parent
end

#resultsObject (readonly)

Returns the value of attribute results.



270
271
272
# File 'lib/a-commons.rb', line 270

def results
  @results
end

#senderObject (readonly)

Returns the value of attribute sender.



266
267
268
# File 'lib/a-commons.rb', line 266

def sender
  @sender
end

#timeObject (readonly)

Returns the value of attribute time.



269
270
271
# File 'lib/a-commons.rb', line 269

def time
  @time
end

Instance Method Details

#add_result(_sender, _args = nil) ⇒ Object



285
286
287
288
289
290
291
292
293
# File 'lib/a-commons.rb', line 285

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

#breakObject



299
300
301
# File 'lib/a-commons.rb', line 299

def break
  @breaked = true
end

#is_breaked?Boolean

Returns:

  • (Boolean)


295
296
297
# File 'lib/a-commons.rb', line 295

def is_breaked?
  @breaked
end