Module: FileLoader

Defined in:
lib/asker/loader/file_loader.rb

Overview

Load a filename and return a Hash with concepts list and code list return { concepts: [], codes: [] }

Class Method Summary collapse

Class Method Details

.call(filename) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/asker/loader/file_loader.rb', line 9

def self.call(filename)
  Logger.debug "==> Loading #{filename}"
  if File.extname(filename).casecmp(".haml").zero?
    file_content = HamlLoader.load filename
  elsif File.extname(filename).casecmp(".xml").zero?
    file_content = File.read(filename)
  else
    Logger.error "FileLoader: HAML or XML required (#{filename})"
    exit 1
  end
  ContentLoader.new.call(filename, file_content)
end