Class: Hyperloop::SendSet

Inherits:
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.



445
446
447
448
449
450
# File 'lib/hyper-operation/transport/policy.rb', line 445

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



452
453
454
455
456
# File 'lib/hyper-operation/transport/policy.rb', line 452

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

#to(*channels) ⇒ Object



441
442
443
# File 'lib/hyper-operation/transport/policy.rb', line 441

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