Class: ThemeCheck::JsonFile

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

Instance Method Summary collapse

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

#contentObject



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

def content
  load!
  @content
end

#nameObject



33
34
35
# File 'lib/theme_check/json_file.rb', line 33

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

#parse_errorObject



28
29
30
31
# File 'lib/theme_check/json_file.rb', line 28

def parse_error
  load!
  @parser_error
end

#pathObject



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

def path
  @storage.path(@relative_path)
end

#relative_pathObject



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

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