Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/flay.rb
Instance Method Summary collapse
- #intersection(other) ⇒ Object
-
#triangle ⇒ Object
TODO: use?.
Instance Method Details
#intersection(other) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/flay.rb', line 356 def intersection other intersection, start = [], 0 other_size = other.length self.each_with_index do |m, i| (start...other_size).each do |j| n = other.at j if m == n then intersection << m start = j + 1 break end end end intersection end |
#triangle ⇒ Object
TODO: use?
372 373 374 375 376 377 378 379 380 381 |
# File 'lib/flay.rb', line 372 def triangle # TODO: use? max = self.size (0...max).each do |i| o1 = at(i) (i+1...max).each do |j| o2 = at(j) yield o1, o2 end end end |