tickle icon indicating copy to clipboard operation
tickle copied to clipboard

undefined method `<=>' for examples

Open jcasimir opened this issue 15 years ago • 1 comments

Trying this example from the docs...

Tickle.parse('beginning of the week')

I get the following error:

ree-1.8.7-2010.02 > Tickle.parse('beginning of the week') NoMethodError: undefined method <=>' for :special:Symbol from /Users/jcasimir/.rvm/gems/ree-1.8.7-2010.02@rails2/gems/tickle-0.1.7/lib/tickle.rb:139:insort' from /Users/jcasimir/.rvm/gems/ree-1.8.7-2010.02@rails2/gems/tickle-0.1.7/lib/tickle.rb:139:in same?' from /Users/jcasimir/.rvm/gems/ree-1.8.7-2010.02@rails2/gems/tickle-0.1.7/lib/tickle/handler.rb:27:inguess_unit_types' from /Users/jcasimir/.rvm/gems/ree-1.8.7-2010.02@rails2/gems/tickle-0.1.7/lib/tickle/handler.rb:11:in guess' from /Users/jcasimir/.rvm/gems/ree-1.8.7-2010.02@rails2/gems/tickle-0.1.7/lib/tickle/tickle.rb:90:inparse' from (irb):7

I looked into the source but I don't grasp the structure enough to figure it out. Any tips?

Versions: tickle (0.1.7) chronic (0.3.0) activesupport (2.3.10)

jcasimir avatar Nov 02 '10 20:11 jcasimir

It seems the issue is just with the .same? method and symbols. I hacked up a replacement which doesn't guarantee that the arrays are identical, but they're at least similar:

Array.class_eval do def same?(second) self.inject(true){|x,y| x && second.include?(y)} && second.inject(true){|x,y| x && self.include?(y)} end end

jcasimir avatar Nov 03 '10 00:11 jcasimir