Sha256: 76f4ab1323ef17f3c557ca22e1ca4700a9897bfd7470655c6f499e66fd0b091d

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true

class RandomObject
  attr_accessor :rating, :queue

  def initialize(options = {})
    @rating = options[:rating] || RandomObject.random_rating
    @queue = RandomObject.list_designation(rating)
  end

  def self.random_rating
    rand(101) # 0 - 100
  end

  def self.list_designation(rating)
    if rating == 0
      'none'
    elsif rating < 34
      'low'
    elsif rating < 67
      'medium'
    else
      'high'
    end
  end

  def to_s
    "RO:#{rating}:#{queue}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qfill-0.1.1 spec/support/random_object.rb
qfill-0.1.0 spec/support/random_object.rb