Class: Bran::LibUV::Reactor::Collections::AbstractSister

Inherits:
Abstract
  • Object
show all
Defined in:
lib/bran/libuv/reactor/collections.rb

Direct Known Subclasses

Read, Write

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #invoke_by_addr, #invoke_by_ident, #invoke_handler, #item_by_ident, #pop, #push

Constructor Details

This class inherits a constructor from Bran::LibUV::Reactor::Collections::Abstract

Instance Attribute Details

#item_poolObject

Returns the value of attribute item_pool.



105
106
107
# File 'lib/bran/libuv/reactor/collections.rb', line 105

def item_pool
  @item_pool
end

#sisterObject

Returns the value of attribute sister.



104
105
106
# File 'lib/bran/libuv/reactor/collections.rb', line 104

def sister
  @sister
end

Instance Method Details

#bond_with(sister) ⇒ Object



107
108
109
110
111
112
113
# File 'lib/bran/libuv/reactor/collections.rb', line 107

def bond_with(sister)
  @sister = sister
  @item_pool = []
  
  @sister.sister = self
  @sister.item_pool = @item_pool
end

#drop_item(ident, item) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/bran/libuv/reactor/collections.rb', line 124

def drop_item(ident, item)
  sister_item = @sister.item_by_ident(ident)
  return super unless sister_item == item
  
  @sister.concrete_sister_unshare_item(ident, item)
  
  nil
end

#make_item(ident, extra_args) ⇒ Object



115
116
117
118
119
120
121
122
# File 'lib/bran/libuv/reactor/collections.rb', line 115

def make_item(ident, extra_args)
  item = @sister.item_by_ident(ident)
  return super unless item
  
  @sister.concrete_sister_share_item(ident, item)
  
  item
end