Class: Errands::Receptors::Receptor

Inherits:
Array
  • Object
show all
Includes:
Track, ThreadAccessor::PrivateAccess
Defined in:
lib/errands/runner.rb

Defined Under Namespace

Modules: Track

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Track

#track

Methods included from ThreadAccessor::PrivateAccess

#err

Constructor Details

#initialize(name) ⇒ Receptor

Returns a new instance of Receptor.



102
103
104
# File 'lib/errands/runner.rb', line 102

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



100
101
102
# File 'lib/errands/runner.rb', line 100

def name
  @name
end

Instance Method Details

#<<(value) ⇒ Object



110
111
112
113
114
# File 'lib/errands/runner.rb', line 110

def <<(value)
  return if value.nil?
  track value, my[:receptor_track] if my
  super.tap { our[:threads][@name] && our[:threads][@name].run }
end

#shift(*_) ⇒ Object



106
107
108
# File 'lib/errands/runner.rb', line 106

def shift(*_)
  my[:data] = super.tap { |value| my.merge! receptor_track: track(value), latency: empty? }
end