Class: Rinda::TupleBag::DataTupleBin Private
- Defined in:
- lib/pione/patch/rinda-patch.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
DataTupleBin is a set of domains.
Instance Method Summary collapse
-
#add(tuple) ⇒ void
private
Adds the tuple.
- #delete(tuple) ⇒ Object private
- #delete_if ⇒ Object private
- #each(*args) ⇒ Object private
- #elements ⇒ Object private
- #find(template, &b) ⇒ Object private
- #find_all(template, &b) ⇒ Object private
-
#initialize ⇒ DataTupleBin
constructor
private
A new instance of DataTupleBin.
Methods inherited from TupleBin
Constructor Details
#initialize ⇒ DataTupleBin
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of DataTupleBin.
224 225 226 |
# File 'lib/pione/patch/rinda-patch.rb', line 224 def initialize @bin = {} end |
Instance Method Details
#add(tuple) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Adds the tuple.
236 237 238 239 |
# File 'lib/pione/patch/rinda-patch.rb', line 236 def add(tuple) prepare_table(domain(tuple)) @bin[domain(tuple)][name(tuple)] = tuple end |
#delete(tuple) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
241 242 243 244 |
# File 'lib/pione/patch/rinda-patch.rb', line 241 def delete(tuple) prepare_table(domain(tuple)) @bin[domain(tuple)].delete(name(tuple)) end |
#delete_if ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
246 247 248 249 250 251 252 253 |
# File 'lib/pione/patch/rinda-patch.rb', line 246 def delete_if if block_given? @bin.values.each do |table| table.delete_if {|_, val| yield(val)} end end return @bin end |
#each(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
296 297 298 |
# File 'lib/pione/patch/rinda-patch.rb', line 296 def each(*args) @bin.values.map{|table| table.values}.flatten.each(*args) end |
#elements ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
228 229 230 |
# File 'lib/pione/patch/rinda-patch.rb', line 228 def elements @bin.values.map{|val| val.values}.flatten end |
#find(template, &b) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/pione/patch/rinda-patch.rb', line 255 def find(template, &b) domain = domain(template) name = name(template) prepare_table(domain) if domain @bin[domain].values.each do |tuple| return tuple if yield(tuple) end else @bin.values.each do |table| table.values.each do |tuple| return tuple if yield(tuple) end end end return nil end |
#find_all(template, &b) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/pione/patch/rinda-patch.rb', line 274 def find_all(template, &b) domain = domain(template) name = name(template) prepare_table(domain) if domain if block_given? return @bin[domain].values.select {|tuple| yield(tuple)} else return @bin[domain].values end else if block_given? return @bin.values.map{|table| table.values}.flatten.select{|tuple| yield(tuple) } else return @bin.values.map{|table| table.values}.flatten end end end |