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.11.0 lib/spandx/core/score.rb
spandx-0.10.1 lib/spandx/core/score.rb
spandx-0.10.0 lib/spandx/core/score.rb
spandx-0.9.0 lib/spandx/core/score.rb
spandx-0.8.0 lib/spandx/core/score.rb
spandx-0.7.0 lib/spandx/core/score.rb
spandx-0.6.0 lib/spandx/core/score.rb