Class: Xsdvi::Utils::ResourceLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/xsdvi/utils/resource_loader.rb

Overview

Helper class for loading resource files

Instance Method Summary collapse

Instance Method Details

#read_resource_file(resource_file) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/xsdvi/utils/resource_loader.rb', line 7

def read_resource_file(resource_file)
  resource_path = File.join(
    File.dirname(__FILE__),
    "../../..",
    "resources",
    resource_file,
  )
  File.read(resource_path)
rescue Errno::ENOENT => e
  warn "Resource file not found: #{resource_path}"
  raise e
end