On Sep 10, 9:02=A0am, Eugen Ciur <eu... / prime-tel.com> wrote:
> I used mostly idioms from Metaprogramming Ruby - Class Extension Mixin
> Any suggestion for improvement ?

The point of a Class Extension Mixin is that you can use to get both
class methods and instance methods with a single include(). If you
only have class methods, you can also use a simple extend() in the
inclusor.

For something as simple as your example, even that might be overkill.
Unless you have a specific reason to decouple the year() method by
putting it in a separate module, you might be better off just defining
it as a class method of Financial:

class EndPoint
  def start
    @start =3D "01/01/"+Time.now.strftime("%Y")
  end
  def finish
    @finish =3D "31/12/"+Time.now.strftime("%Y")
  end
end

module Financial
  def self.year
    EndPoint.new
  end
end

Financial.year.start      # =3D> "01/01/2010"
Financial.year.finish     # =3D> "31/12/2010"

  Paolo Perrotta
  Metaprogramming Ruby (http://www.pragprog.com/titles/ppmetr)