Sha256: e14ce09c6007c4f163c2e2ad54cab9d723da5483f3b75c10e2bf2c649ffd483a

Contents?: true

Size: 684 Bytes

Versions: 7

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true
require "pathname"

module ThemeCheck
  class ThemeFile
    def initialize(relative_path, storage)
      @relative_path = relative_path
      @storage = storage
    end

    def path
      @storage.path(@relative_path)
    end

    def relative_path
      @relative_pathname ||= Pathname.new(@relative_path)
    end

    def name
      relative_path.sub_ext('').to_s
    end

    def source
      @source ||= @storage.read(@relative_path)
    end

    def json?
      false
    end

    def liquid?
      false
    end

    def ==(other)
      other.is_a?(self.class) && relative_path == other.relative_path
    end
    alias_method :eql?, :==
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
theme-check-1.5.2 lib/theme_check/theme_file.rb
theme-check-1.5.1 lib/theme_check/theme_file.rb
theme-check-1.5.0 lib/theme_check/theme_file.rb
theme-check-1.4.0 lib/theme_check/theme_file.rb
theme-check-1.3.0 lib/theme_check/theme_file.rb
theme-check-1.2.0 lib/theme_check/theme_file.rb
theme-check-1.1.0 lib/theme_check/theme_file.rb