.serialhex .. wrote in post #965797:
> Edit: Andrew your solution works too, (i didnt see it before, even tho
> you posted first) but thats alot of self.xxx's.  is the main library
> written like that? is Math written:
>
> module Math
>   def self.sine(x)
>     # sine stuff
>   end
>   def self.cos(x)
>     # cosine stuff
>   end
> end
>
> ???  that seems a little tedious (though i imagine with some nifty
> metaprogramming you can add all the self's) that just kinda seems odd to
> me.

There is module_function (which is subtly different though :-)

module Math
  module_function
  def sinc(x)
    sin(PI*x)/PI*x
  end
end

# or you can do module_function :sinc after the definition

>> Math.sinc(0.5)
=> 0.159154943091895

-- 
Posted via http://www.ruby-forum.com/.