class ERBLint::FileLoader

Loads file from disk

Attributes

base_path[R]

Public Class Methods

new(base_path) click to toggle source
# File lib/erb_lint/file_loader.rb, line 8
def initialize(base_path)
  @base_path = base_path
end

Public Instance Methods

yaml(filename) click to toggle source
# File lib/erb_lint/file_loader.rb, line 13
def yaml(filename)
  YAML.safe_load(read_content(filename), permitted_classes: [Regexp, Symbol], filename: filename) || {}
end

Private Instance Methods

read_content(filename) click to toggle source
# File lib/erb_lint/file_loader.rb, line 24
def read_content(filename)
  path = File.expand_path(filename, base_path)
  File.read(path)
end