[MacRuby] #854: Time and NSDate cannot be compared with Comparable operators
MacRuby
ruby-noreply at macosforge.org
Mon Aug 23 16:41:56 PDT 2010
#854: Time and NSDate cannot be compared with Comparable operators
----------------------------------+-----------------------------------------
Reporter: massicotte@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: minor | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
Description changed by martinlagardette@…:
Old description:
> Time is now relatively equivalent to NSDate, but they cannot be compared
> with the Comparable operators. If compare: works, <=> should be
> implemented as well.
>
> $ macirb
> irb(main):001:0> date = NSDate.date
> => #<__NSCFDate:0x20023d3a0>
> irb(main):002:0> time = Time.now
> => 2010-08-17 16:28:46 -0700
> irb(main):003:0> time < date
> ArgumentError: comparison of Time with __NSCFDate failed
>
> irb(main):005:0> date.compare(time)
> => -1
> irb(main):006:0> time.compare(date)
> => 1
> irb(main):007:0>
New description:
Time is now relatively equivalent to NSDate, but they cannot be compared
with the Comparable operators. If compare: works, <=> should be
implemented as well.
{{{
$ macirb
irb(main):001:0> date = NSDate.date
=> #<__NSCFDate:0x20023d3a0>
irb(main):002:0> time = Time.now
=> 2010-08-17 16:28:46 -0700
irb(main):003:0> time < date
ArgumentError: comparison of Time with __NSCFDate failed
irb(main):005:0> date.compare(time)
=> -1
irb(main):006:0> time.compare(date)
=> 1
irb(main):007:0>
}}}
--
--
Ticket URL: <http://www.macruby.org/trac/ticket/854#comment:2>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list