Sha256: 47676528457c079168ddf5270d4f3fc12f4f0d34d4476712820820ae488aa2c2

Contents?: true

Size: 484 Bytes

Versions: 7

Compression:

Stored size: 484 Bytes

Contents

== Comparable#[]

  require 'facets/comparable/op_get'

  c = Class.new do
    include Comparable[:a,:b]

    attr_accessor :a, :b

    def initialize(a,b)
      @a=a; @b=b
    end
  end

  a = [c.new(10,20),c.new(10,30)]
  a.sort.assert == a

  a = [c.new(10,30),c.new(10,20)]
  a.sort.assert == a.reverse

  a = [c.new(10,10),c.new(20,10)]
  a.sort.assert == a

  a = [c.new(20,10),c.new(10,10)]
  a.sort.assert == a.reverse

  a = [c.new(10,30),c.new(20,10)]
  a.sort.assert == a

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
facets-3.0.0 demo/core/comparable/op_get.rdoc
facets-2.9.3 qed/core/comparable/op_get.rdoc
facets-2.9.2 qed/core/comparable/op_get.rdoc
facets-2.9.1 qed/core/comparable/op_get.rdoc
facets-2.9.0 qed/core/comparable/op_get.rdoc
facets-2.9.0.pre.2 qed/core/comparable/op_get.rdoc
facets-2.9.0.pre.1 qed/core/comparable/op_get.rdoc