class RubyCritic::Rating

Public Class Methods

from_cost(cost) click to toggle source
# File lib/rubycritic/core/rating.rb, line 5
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
new(letter) click to toggle source
# File lib/rubycritic/core/rating.rb, line 15
def initialize(letter)
  @letter = letter
end

Public Instance Methods

to_h() click to toggle source
# File lib/rubycritic/core/rating.rb, line 23
def to_h
  @letter
end
to_json(*options) click to toggle source
# File lib/rubycritic/core/rating.rb, line 27
def to_json(*options)
  to_h.to_json(*options)
end
to_s() click to toggle source
# File lib/rubycritic/core/rating.rb, line 19
def to_s
  @letter
end