Class: LongMath::CacheKey
- Inherits:
-
Struct
- Object
- Struct
- LongMath::CacheKey
- Includes:
- Comparable
- Defined in:
- lib/long-decimal.rb,
lib/long-decimal.rb
Overview
used as key to store an already calculated value for any triplet of function name (fname), argument (arg, typically 2, 3, 5, 10 or so) and internal rounding mode (mode)
Instance Method Summary collapse
-
#<=>(o) ⇒ Object
introduce some ordering for cache keys.
Instance Method Details
#<=>(o) ⇒ Object
introduce some ordering for cache keys
2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 |
# File 'lib/long-decimal.rb', line 2613 def <=>(o) r = 0 if o.respond_to?:fname r = self.fname <=> o.fname else r = self.fname <=> o end return r if (r != 0) if o.respond_to?:arg r = self.arg <=> o.arg else r = self.arg <=> o end return r if (r != 0) if o.respond_to?:mode r = self.mode <=> o.mode else r = self.mode <=> o end return r end |