Sha256: 2fd5de617de72bdcbf833565b5abba457af775fb39ba7ca12494fba768d9d561

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

module RubyCritic
  class Rating
    def self.from_cost(cost)
      if    cost <= 2  then new('A')
      elsif cost <= 4  then new('B')
      elsif cost <= 8  then new('C')
      elsif cost <= 16 then new('D')
      else new('F')
      end
    end

    def initialize(letter)
      @letter = letter
    end

    def to_s
      @letter
    end

    def to_h
      @letter
    end

    def to_json(*a)
      to_h.to_json(*a)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubycritic-2.9.3 lib/rubycritic/core/rating.rb