Sha256: 739eb8011ab232bafea6677702695b0cfb0972abfe263d5ba573a7bbf9db3af1

Contents?: true

Size: 388 Bytes

Versions: 2

Compression:

Stored size: 388 Bytes

Contents

# run system with a single command
module Runnable
  def run
    reject!(&:done?)
    each(&:display)
  end
end

# A custom enumerable class, it is so easy in ruby
class ParticleSystem
  include Enumerable, Runnable
  extend Forwardable
  def_delegators(:@pairs, :each, :reject!, :<<)
  
  def initialize
    @pairs = []
  end
  
  def add_pair(x, y)
    self << Pair.new(x, y)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pbox2d-0.5.0-java examples/distance_joint/particle_system.rb
pbox2d-0.4.2-java examples/distance_joint/particle_system.rb