Class: ThemeCheck::ThemeFile

Inherits:
Object
  • Object
show all
Defined in:
lib/theme_check/theme_file.rb

Direct Known Subclasses

AssetFile, JsonFile, Template

Instance Method Summary collapse

Constructor Details

#initialize(relative_path, storage) ⇒ ThemeFile

Returns a new instance of ThemeFile.



6
7
8
9
# File 'lib/theme_check/theme_file.rb', line 6

def initialize(relative_path, storage)
  @relative_path = relative_path
  @storage = storage
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



35
36
37
# File 'lib/theme_check/theme_file.rb', line 35

def ==(other)
  other.is_a?(self.class) && relative_path == other.relative_path
end

#json?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/theme_check/theme_file.rb', line 27

def json?
  false
end

#liquid?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/theme_check/theme_file.rb', line 31

def liquid?
  false
end

#nameObject



19
20
21
# File 'lib/theme_check/theme_file.rb', line 19

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

#pathObject



11
12
13
# File 'lib/theme_check/theme_file.rb', line 11

def path
  @storage.path(@relative_path)
end

#relative_pathObject



15
16
17
# File 'lib/theme_check/theme_file.rb', line 15

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

#sourceObject



23
24
25
# File 'lib/theme_check/theme_file.rb', line 23

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