[Nitro] Concerns over Og mandating the form of initialize

George Moschovitis george.moschovitis at gmail.com
Thu Apr 14 13:59:52 EDT 2005


class Foo
  prop_accessor :x, :y # properties to be saved


> Here's a variation:
> 
> class Foo
>    attr_accessor  :x, :y
>    def initialize( x=nil, y=nil )
>       @x = x
>       @y = y
>       @tstamp = Time.new
>    end
> 
>    def is_too_old?
>       t = Time.now
>       ( t.to_i - @tstamp.to_i > 1000000 )
>    end
> 
> end
> 
> How can @tstamp be saved or set?
> 
> I believe, then, that under Og, this must become something like:
> 
>    def initialize( x=nil, y=nil )
>       @x = x
>       @y = y
>       post_og_read
>    end
> 
>    def post_og_read
>       @tstamp = Time.new
>       # maybe also validate values of @x and @y
>    end
> 
> James
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
> 


-- 
http://nitro.rubyforge.org
http://www.joy.gr




More information about the Nitro-general mailing list