diff options
Diffstat (limited to 'spec/ruby/core/integer/fixtures/classes.rb')
| -rw-r--r-- | spec/ruby/core/integer/fixtures/classes.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/integer/fixtures/classes.rb b/spec/ruby/core/integer/fixtures/classes.rb new file mode 100644 index 0000000000..65948efb9f --- /dev/null +++ b/spec/ruby/core/integer/fixtures/classes.rb @@ -0,0 +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 |
