Bugs: Browse | Submit New | Admin

[#21361] undefined method `new!' for Runt::PDate:Class

Date:
2008-07-28 07:20
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
undefined method `new!' for Runt::PDate:Class

Detailed description
i have troubles with the 'dates' method of TE

Running the attached testcase with 0.6.0 works, but 0.7.0 fails with 
NoMethodError: undefined method `new!' for Runt::PDate:Class
    /usr/local/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdate.rb:93:in `new_self_plus'
    /usr/local/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdate.rb:56:in `+'
    /usr/local/lib/ruby/1.8/date.rb:1004:in `succ'
    /usr/local/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temporalexpression.rb:71:in `each'
    /usr/local/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temporalexpression.rb:71:in `dates'
    runt_dates_test.rb:10:in `test_dates'


ruby --version
ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.1]


had the same problems on 1.8.6, i think (no access to that computer right now)








Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-08-04 14:59
Sender: João Duarte

This is a mirror of a production system, so I can't do many tests.

I did, however, upgrade ruby to 1.8.7 (which I won't be able
to in production environment). It works.

$ ruby -v
ruby 1.8.7 (2008-06-20 patchlevel 22) [i486-linux]

irb(main):004:0* test = Runt::DateRange.new(
irb(main):005:1*         Runt::PDate.day(2008,8,1),
irb(main):006:1*         Runt::PDate.day(2008,8,4))
=> #<Runt::PDate: 4909359/2,0,2299161>..#<Runt::PDate:
4909365/2,0,2299161>
irb(main):007:0> Runt::REWeek.new(1,5).dates(test)
=> [#<Runt::PDate: 4909359/2,0,2299161>, #<Runt::PDate:
4909365/2,0,2299161>]

This helps?
Date: 2008-08-04 14:35
Sender: Michael Scappa

Matthew thinks its a problem with pre 1.8.6 ruby versions. Can
you try upgrading your version to see if it works? I'm running
on a production server right now so upgrading isn't that easy,
but i would do it if it fixes the problem.
Date: 2008-08-04 14:13
Sender: João Duarte

Any advances in finding the cause of the issue?

I'm having the same problem (debian etch):

$ ruby -v
ruby 1.8.5 (2006-08-25) [i486-linux]
$ gem list | grep runt
runt (0.7.0)


When I do:

require 'rubygems'
require 'runt'

test = Runt::DateRange.new(
        Runt::PDate.day(2008,8,1),
        Runt::PDate.day(2008,8,4))
Runt::REWeek.new(1,5).dates(test)

It produces:

NoMethodError: undefined method `new!' for Runt::PDate:Class
	from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdate.rb:93:in
`new_self_plus'
	from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdate.rb:56:in
`+'
	from /usr/lib/ruby/1.8/date.rb:1004:in `succ'
	from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temporalexp
ression.rb:71:in `each'
	from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temporalexp
ression.rb:71:in `dates'
	from (irb):8
	from :0

Thanks in advance,

João Duarte
Date: 2008-08-01 18:44
Sender: Matthew Lipper 

I could not reproduce this either. Perhaps we can continue this
directly? My email address is mlipper AT gmail DOT com.

Thanks,

Matt
Date: 2008-08-01 14:52
Sender: Michael Scappa

Matthew, Add in the EveryTE TExpr

expr &= Runt::EveryTE.new(start_date,2,Runt::DPrecision::WEEK
)

then run expr.dates...
Date: 2008-08-01 14:43
Sender: Matthew Lipper 

I can't reproduce this using the latest Runt code from
Subversion:

ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

irb(main):001:0> start_date = Runt::PDate.day(2008,1,1)
=> #<Runt::PDate: 4908933/2,0,2299161>
irb(main):002:0> end_date = Runt::PDate.day(2008,2,1)
=> #<Runt::PDate: 4908995/2,0,2299161>
irb(main):003:0> expr = Runt::DIWeek.new(1)
=> #<Runt::DIWeek:0x6e40060 @ordinal_weekday=1>
irb(main):004:0> expr.dates(Runt::DateRange.new(start_date,end
_date)).inspect
=> "[#<Runt::PDate: 4908945/2,0,2299161>,
#<Runt::PDate: 4908959/2,0,2299161>, #<Runt::PDate:
490897
3/2,0,2299161>, #<Runt::PDate:
4908987/2,0,2299161>]"
Date: 2008-08-01 14:24
Sender: Michael Scappa

http://www.pastie.org/245606
Date: 2008-08-01 14:23
Sender: Michael Scappa

Here is a better sample:

irb(main):002:0> require 'rubygems'
=> true
irb(main):003:0> require 'runt'
=> true
irb(main):005:0> expr = Runt::DIWeek.new(1)
=> #<Runt::DIWeek:0xb7c056b4 @ordinal_weekday=1>
irb(main):007:0> expr.dates(Runt::DateRange.new(Date.new(2008,
1,1),Date.new(2008,2,1))).inspect
=> "[#<Date: 4908945/2,0,2299161>, #<Date:
4908959/2,0,2299161>, #<Date: 4908973/2,0,2299161>,
#<Date: 4908987/2,0,2299161>]"
irb(main):008:0> expr &=
Runt::EveryTE.new(Date.new(2008,1,1),2,Runt::DPrecision::WEEK)
=> #<Runt::Intersect:0xb7bd4190
@expressions=[#<Runt::DIWeek:0xb7c056b4 @ordinal_weekday=1>,
#<Runt::EveryTE:0xb7bd4578
@precision=#<Runt::DPrecision::Precision:0xb7b5e170
@precision=2>, @interval=2, @start=#<Date:
4908933/2,0,2299161>>]>
irb(main):009:0> expr.dates(Runt::DateRange.new(Date.new(2008,
1,1),Date.new(2008,2,1))).inspect
NoMethodError: undefined method `new!' for Runt::PDate:Class
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdat
e.rb:93:in `new_self_plus'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdat
e.rb:54:in `+'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temp
oralexpression.rb:694:in `include?'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temp
oralexpression.rb:158:in `include?'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temp
oralexpression.rb:157:in `include?'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temp
oralexpression.rb:72:in `dates'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temp
oralexpression.rb:71:in `dates'
        from (irb):9
irb(main):010:0> 
Date: 2008-08-01 13:59
Sender: Michael Scappa

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'runt'
=> true
irb(main):003:0> start_date = Runt::PDate.day(2008,1,1)
=> #<Runt::PDate: 4908933/2,0,2299161>
irb(main):004:0> end_date = Runt::PDate.day(2008,2,1)
=> #<Runt::PDate: 4908995/2,0,2299161>
irb(main):007:0> expr = Runt::DIWeek.new(1)  
=> #<Runt::DIWeek:0xb7b5a1b4 @ordinal_weekday=1>
irb(main):010:0> expr.dates(Runt::DateRange.new(start_date,end
_date)).inspect
NoMethodError: undefined method `new!' for Runt::PDate:Class
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdat
e.rb:93:in `new_self_plus'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/pdat
e.rb:56:in `+'
        from /usr/lib/ruby/1.8/date.rb:1004:in `succ'
        from /usr/lib/ruby/gems/1.8/gems/runt-0.7.0/lib/runt/temp
oralexpression.rb:71:in `dates'
        from (irb):10

Happens more frequently when you use EveryTE and such
Date: 2008-08-01 12:18
Sender: Matthew Lipper 

Can you please provide a code example which demonstrates the
issue?
Date: 2008-07-31 15:01
Sender: Michael Scappa

Any updates on this? I'm having the same exact problem. 

Its related to PDate. When I test include? on expressions that
simply use DIWeek and the like, it works fine. However, when
I add in EveryTE and such, it fails with the above error.
Date: 2008-07-29 17:09
Sender: Matthew Lipper 

Please attach the test case mentioned in the description

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item