Sha256: 5a276ef641dbe0a766f5957fc15309c3c1d252d99ac4d5596927246810f085bd

Contents?: true

Size: 521 Bytes

Versions: 9

Compression:

Stored size: 521 Bytes

Contents

require 'forwardable'

module Prj

  class DirWithScore
    include Comparable
    extend Forwardable

    attr_accessor :dir, :score

    def_delegators :dir, :length, :to_s

    def initialize(dir, score)
      @dir, @score = dir, score
    end

    def <=>(other)
      if score < other.score
        -1
      elsif score > other.score
        1
      else
        if length < other.length
          -1
        elsif  length > other.length
          1
        else
          0
        end
      end
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
prj-2.0.1 lib/prj/dir_with_score.rb
prj-2.0.1.pre.2 lib/prj/dir_with_score.rb
prj-2.0.1.pre.1 lib/prj/dir_with_score.rb
prj-2.0.0 lib/prj/dir_with_score.rb
prj-1.0.2 lib/prj/dir_with_score.rb
prj-1.0.1 lib/prj/dir_with_score.rb
prj-1.0.0 lib/prj/dir_with_score.rb
prj-0.1.0 lib/prj/dir_with_score.rb
prj-0.0.2 lib/prj/dir_with_score.rb