Guest User

Untitled

a guest
Sep 26th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.34 KB | None | 0 0
  1. class Density
  2.   include Enumerable
  3.   extend Forwardable
  4.  
  5.   attr_accessor :uniform, :fail, :exact, :d
  6.   def_delegators :@d, :each, :[], :[]=, :inspect, :delete
  7.  
  8.   def initialize(num=0)
  9.     @d=Hash.new(Rational(0))
  10.     @d[num]=Rational(1)
  11.     @uniform=true
  12.     @exact=true
  13.     @fail=false
  14.   end
  15.  
  16.   ... (many things, e.g. +() operator
  17. end
Advertisement
Add Comment
Please, Sign In to add comment