Class: DevSuite::Utils::FileLoader::Loader::Json

Inherits:
Base show all
Defined in:
lib/dev_suite/utils/file_loader/loader/json.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Construct::Component::Base

component_key

Class Method Details

.extensionsObject



9
10
11
# File 'lib/dev_suite/utils/file_loader/loader/json.rb', line 9

def extensions
  ["json"]
end

Instance Method Details

#load(path) ⇒ Object



14
15
16
17
18
19
# File 'lib/dev_suite/utils/file_loader/loader/json.rb', line 14

def load(path)
  content = ::File.read(path)
  return {} if content.strip.empty?

  ::JSON.parse(content)
end