Sha256: 6f0d95076fee065b1996f6b55a46cd79cf5006de659c1ac1af137370859df765

Contents?: true

Size: 482 Bytes

Versions: 4

Compression:

Stored size: 482 Bytes

Contents

module Fontist
  class IndexFormula
    def initialize(path)
      @path = path
    end

    def to_s
      normalized
    end

    def to_full
      Formula.new_from_file(full_path)
    end

    def ==(other)
      to_s == other.to_s
    end

    private

    def normalized
      escaped = Regexp.escape(Fontist.formulas_path.to_s + "/")
      @path.sub(Regexp.new("^" + escaped), "")
    end

    def full_path
      Fontist.formulas_path.join(normalized).to_s
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fontist-1.8.4 lib/fontist/index_formula.rb
fontist-1.8.3 lib/fontist/index_formula.rb
fontist-1.8.2 lib/fontist/index_formula.rb
fontist-1.8.1 lib/fontist/index_formula.rb