Sha256: a8778b4df50d10e34be8dbdf4be617fbf353b236e03b7544ce55de05abbec62b

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

require 'yaml'

module Dsfu
  class Size
    include Comparable
    attr_reader :width, :height

    @@sizes = Marshal::load(File.read(File.expand_path('../../../db/sizes_serial', __FILE__)))

    class << self
      def all
        @@sizes
      end
    end

    def initialize(width, height)
      @width, @height = width.to_f, height.to_f
    end

    def <=>(other)
      (width * height) <=> (other.width * other.height)
    end

    def square?
      width == height
    end

    def strip?
      width * 6 < height ||
      width > height * 6
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dsfu-0.0.1 lib/dsfu/size.rb