Sha256: f8195b0871c4587ea9434b380bb709865904fd76e80357a3cffcf874c650b326

Contents?: true

Size: 492 Bytes

Versions: 27

Compression:

Stored size: 492 Bytes

Contents

# frozen_string_literal: true

module Spandx
  module Core
    class Score
      include Comparable

      attr_reader :score, :item

      def initialize(score, item)
        update(score || 0.0, item)
      end

      def update(score, item)
        @score = score
        @item = item
      end

      def empty?
        score.nil? || item.nil?
      end

      def <=>(other)
        score <=> other.score
      end

      def to_s
        "#{score}: #{item}"
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
spandx-0.18.3 lib/spandx/core/score.rb
spandx-0.18.2 lib/spandx/core/score.rb
spandx-0.18.1 lib/spandx/core/score.rb
spandx-0.18.0 lib/spandx/core/score.rb
spandx-0.17.0 lib/spandx/core/score.rb
spandx-0.16.1 lib/spandx/core/score.rb
spandx-0.16.0 lib/spandx/core/score.rb
spandx-0.15.1 lib/spandx/core/score.rb
spandx-0.15.0 lib/spandx/core/score.rb
spandx-0.14.0 lib/spandx/core/score.rb
spandx-0.13.5 lib/spandx/core/score.rb
spandx-0.13.4 lib/spandx/core/score.rb
spandx-0.13.3 lib/spandx/core/score.rb
spandx-0.13.2 lib/spandx/core/score.rb
spandx-0.13.1 lib/spandx/core/score.rb
spandx-0.13.0 lib/spandx/core/score.rb
spandx-0.12.3 lib/spandx/core/score.rb
spandx-0.12.2 lib/spandx/core/score.rb
spandx-0.12.1 lib/spandx/core/score.rb
spandx-0.12.0 lib/spandx/core/score.rb