diff options
Diffstat (limited to 'spec/ruby/core/integer/fixtures/classes.rb')
| -rw-r--r-- | spec/ruby/core/integer/fixtures/classes.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/core/integer/fixtures/classes.rb b/spec/ruby/core/integer/fixtures/classes.rb index 6ebfbd1565..65948efb9f 100644 --- a/spec/ruby/core/integer/fixtures/classes.rb +++ b/spec/ruby/core/integer/fixtures/classes.rb @@ -1,4 +1,14 @@ module IntegerSpecs class CoerceError < StandardError end + + class CoercibleNumeric + def initialize(v) @v = v end + def coerce(other) [self.class.new(other), self] end + def >(other) @v.to_i > other.to_i end + def >=(other) @v.to_i >= other.to_i end + def <(other) @v.to_i < other.to_i end + def <=(other) @v.to_i <= other.to_i end + def to_i() @v.to_i end + end end |
