Sha256: 1c861d6110bfaf30fec666714bb93266883fbe0c7873b3c2fca0b93c9231eb12

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

module Fontist
  class StyleVersion
    def initialize(text)
      @text = text
    end

    def to_s
      value.join(" . ")
    end

    def value
      @value ||= numbers || default_value
    end

    def numbers
      string_version&.split(".")&.map(&:strip)
    end

    def string_version
      @text&.split(";")&.first
    end

    def default_value
      ["0"]
    end

    def <=>(other)
      value <=> other.value
    end

    def ==(other)
      value == other.value
    end

    def eql?(other)
      value.eql?(other.value)
    end

    def hash
      value.hash
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fontist-1.21.2 lib/fontist/style_version.rb
fontist-1.21.1 lib/fontist/style_version.rb