Sha256: d5ef3af73e20b68f2bd2dbdf992d5f18344f3ee75cdceb08e16d071f332431e5

Contents?: true

Size: 372 Bytes

Versions: 3

Compression:

Stored size: 372 Bytes

Contents

module Basic101

  module BasicComparisons

    def self.comparison_op(method, op)
      define_method(method) do |other|
        BasicInteger.from_bool(self.send(op, other))
      end
    end

    comparison_op :lt, '<'
    comparison_op :le, '<='
    comparison_op :eq, '=='
    comparison_op :ge, '>='
    comparison_op :gt, '>'
    comparison_op :ne, '!='

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-0.4.0 lib/basic101/basic_comparisons.rb
basic101-0.2.0 lib/basic101/basic_comparisons.rb
basic101-0.1.0 lib/basic101/basic_comparisons.rb