Class: Hyperloop::SendSet

Inherits:
Object
  • Object
show all
Defined in:
lib/hyper-operation/transport/policy.rb

Instance Method Summary collapse

Constructor Details

#initialize(policy, exclude: nil, white_list: nil) ⇒ SendSet

Returns a new instance of SendSet.


510
511
512
513
514
515
# File 'lib/hyper-operation/transport/policy.rb', line 510

def initialize(policy, exclude: nil, white_list: nil)
  @policy = policy
  @policy.add_unassigned_send_set(self)
  @excluded = exclude.map &:to_sym if exclude
  @white_list = white_list.map &:to_sym if white_list
end

Instance Method Details

#merge(set) ⇒ Object


517
518
519
520
521
# File 'lib/hyper-operation/transport/policy.rb', line 517

def merge(set)
  set = set.difference(@excluded) if @excluded
  set = set.intersection(@white_list) if @white_list
  set
end

#to(*channels) ⇒ Object


506
507
508
# File 'lib/hyper-operation/transport/policy.rb', line 506

def to(*channels)
  @policy.send_set_to(self, channels)
end