Class: Wisper::Visualize::RecordingBroadcaster::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/wisper/visualize/recording_broadcaster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subscriber, publisher, name, args) ⇒ Event

Returns a new instance of Event.



40
41
42
43
44
45
46
47
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 40

def initialize(subscriber, publisher, name, args)
  @subscriber_name = label(subscriber)
  @publisher_name  = label(publisher)
  @name            = name
  @arg_names       = arg_labels(args)
  @frequency       = 1
  @created_at      = Time.now
end

Instance Attribute Details

#arg_namesObject (readonly)

Returns the value of attribute arg_names.



37
38
39
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 37

def arg_names
  @arg_names
end

#created_atObject (readonly)

Returns the value of attribute created_at.



37
38
39
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 37

def created_at
  @created_at
end

#frequencyObject (readonly)

Returns the value of attribute frequency.



37
38
39
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 37

def frequency
  @frequency
end

#nameObject (readonly)

Returns the value of attribute name.



37
38
39
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 37

def name
  @name
end

#publisher_nameObject (readonly)

Returns the value of attribute publisher_name.



37
38
39
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 37

def publisher_name
  @publisher_name
end

#subscriber_nameObject (readonly)

Returns the value of attribute subscriber_name.



37
38
39
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 37

def subscriber_name
  @subscriber_name
end

Instance Method Details

#==(other) ⇒ Object



57
58
59
60
61
62
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 57

def ==(other)
  name == other.name &&
  # arg_names == other.arg_names &&
  subscriber_name == other.subscriber_name &&
  publisher_name == other.publisher_name
end

#frequency_labelObject



49
50
51
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 49

def frequency_label
  frequency == 1 ? '' : "#{frequency}x "
end

#increment_frequencyObject



53
54
55
# File 'lib/wisper/visualize/recording_broadcaster.rb', line 53

def increment_frequency
  @frequency += 1
end