Class: ThemeCheck::JsonFile
- Inherits:
-
Object
- Object
- ThemeCheck::JsonFile
- Defined in:
- lib/theme_check/json_file.rb
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #content ⇒ Object
-
#initialize(relative_path, storage) ⇒ JsonFile
constructor
A new instance of JsonFile.
- #json? ⇒ Boolean
- #liquid? ⇒ Boolean
- #name ⇒ Object
- #parse_error ⇒ Object
- #path ⇒ Object
- #relative_path ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(relative_path, storage) ⇒ JsonFile
Returns a new instance of JsonFile.
7 8 9 10 11 12 13 |
# File 'lib/theme_check/json_file.rb', line 7 def initialize(relative_path, storage) @relative_path = relative_path @storage = storage @loaded = false @content = nil @parser_error = nil end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
49 50 51 |
# File 'lib/theme_check/json_file.rb', line 49 def ==(other) other.is_a?(JsonFile) && relative_path == other.relative_path end |
#content ⇒ Object
27 28 29 30 |
# File 'lib/theme_check/json_file.rb', line 27 def content load! @content end |
#json? ⇒ Boolean
41 42 43 |
# File 'lib/theme_check/json_file.rb', line 41 def json? true end |
#liquid? ⇒ Boolean
45 46 47 |
# File 'lib/theme_check/json_file.rb', line 45 def liquid? false end |
#name ⇒ Object
37 38 39 |
# File 'lib/theme_check/json_file.rb', line 37 def name relative_path.sub_ext('').to_s end |
#parse_error ⇒ Object
32 33 34 35 |
# File 'lib/theme_check/json_file.rb', line 32 def parse_error load! @parser_error end |
#path ⇒ Object
15 16 17 |
# File 'lib/theme_check/json_file.rb', line 15 def path @storage.path(@relative_path) end |
#relative_path ⇒ Object
19 20 21 |
# File 'lib/theme_check/json_file.rb', line 19 def relative_path @relative_pathname ||= Pathname.new(@relative_path) end |
#source ⇒ Object
23 24 25 |
# File 'lib/theme_check/json_file.rb', line 23 def source @source ||= @storage.read(@relative_path) end |