Sha256: 5bf309a0895954cec9a8c3fc91f35f0a8abc6cc1c18f26b570b71bcc488b4942

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

require_relative 'content_loader'
require_relative 'haml_loader'
require_relative '../logger'

# Methods that load a filename and return list of concepts
module FileLoader
  ##
  # Load asker data from file
  # @param filename (String) File name to be load
  def self.load(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
      msg = "[ERROR] FileLoader: Format error #{filename}"
      Logger.verboseln msg
      raise msg
    end
    ContentLoader.load(filename, file_content)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asker-tool-2.2.0 lib/asker/loader/file_loader.rb