Sha256: 249f0b4b228db06a200ae364fc034fcd251fe37354c12ba659328db2b47534c7
Contents?: true
Size: 899 Bytes
Versions: 3
Compression:
Stored size: 899 Bytes
Contents
# workaround for an infinite loop in Opal 0.6.2 when comparing numbers module Comparable def == other return true if equal? other return false unless cmp = (self <=> other) return `cmp == 0` rescue StandardError false end def > other unless cmp = (self <=> other) raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" end `cmp > 0` end def >= other unless cmp = (self <=> other) raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" end `cmp >= 0` end def < other unless cmp = (self <=> other) raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" end `cmp < 0` end def <= other unless cmp = (self <=> other) raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" end `cmp <= 0` end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
asciidoctor-1.5.2 | lib/asciidoctor/opal_ext/comparable.rb |
asciidoctor-1.5.1 | lib/asciidoctor/opal_ext/comparable.rb |
asciidoctor-1.5.0 | lib/asciidoctor/opal_ext/comparable.rb |