Sha256: 31cfd44f5862fc90cb968c8b04c61bb87fc62081a08b0d6a0ec96c2bd1a82b81

Contents?: true

Size: 386 Bytes

Versions: 8

Compression:

Stored size: 386 Bytes

Contents

module Kosher
  class Condition < Struct.new(:in_words)
    def to_i
      case in_words
      when 'new' then 1
      when 'mint' then 2
      when 'verygood' then 3
      when 'good' then 4
      when 'acceptable' then 5
      else 6
      end
    end

    def kosher?
      to_i <= 4
    end

    def new?
      in_words == 'new'
    end

    def used?
      !new?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kosher-0.1.10 lib/kosher/condition.rb
kosher-0.1.9 lib/kosher/condition.rb
kosher-0.1.8 lib/kosher/condition.rb
kosher-0.1.7 lib/kosher/condition.rb
kosher-0.1.6 lib/kosher/condition.rb
kosher-0.1.5 lib/kosher/condition.rb
kosher-0.1.4 lib/kosher/condition.rb
kosher-0.1.3 lib/kosher/condition.rb