From 77e50caaf2ef81cd91075cf836fed0e75718ffb4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 23:12:02 +0200 Subject: Adding debian version 1.8.3-2. Signed-off-by: Daniel Baumann --- debian/vendor-h2o/deps/mruby/mrblib/compar.rb | 84 +++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 debian/vendor-h2o/deps/mruby/mrblib/compar.rb (limited to 'debian/vendor-h2o/deps/mruby/mrblib/compar.rb') diff --git a/debian/vendor-h2o/deps/mruby/mrblib/compar.rb b/debian/vendor-h2o/deps/mruby/mrblib/compar.rb new file mode 100644 index 0000000..84b9625 --- /dev/null +++ b/debian/vendor-h2o/deps/mruby/mrblib/compar.rb @@ -0,0 +1,84 @@ +## +# Comparable +# +# ISO 15.3.3 +module Comparable + + ## + # Return true if +self+ is less + # than +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.1 + def < other + cmp = self <=> other + if cmp.nil? + raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" + end + cmp < 0 + end + + ## + # Return true if +self+ is less + # than or equal to +other+. + # Otherwise return false. + # + # ISO 15.3.3.2.2 + def <= other + cmp = self <=> other + if cmp.nil? + raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" + end + cmp <= 0 + end + + ## + # Return true if +self+ is equal + # to +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.3 + def == other + cmp = self <=> other + cmp == 0 + end + + ## + # Return true if +self+ is greater + # than +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.4 + def > other + cmp = self <=> other + if cmp.nil? + raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" + end + cmp > 0 + end + + ## + # Return true if +self+ is greater + # than or equal to +other+. + # Otherwise return false. + # + # ISO 15.3.3.2.5 + def >= other + cmp = self <=> other + if cmp.nil? + raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" + end + cmp >= 0 + end + + ## + # Return true if +self+ is greater + # than or equal to +min+ and + # less than or equal to +max+. + # Otherwise return false. + # + # ISO 15.3.3.2.6 + def between?(min, max) + self >= min and self <= max + end +end -- cgit v1.2.3