class Erubis::Main

def load_datafiles(filenames, opts)

def load_datafiles(filenames, opts)
  context = Erubis::Context.new
  return context unless filenames
  filenames.split(/,/).each do |filename|
    filename.strip!
    test(?f, filename) or raise CommandOptionError.new("#{filename}: file not found.")
    if filename =~ /\.ya?ml$/
      if opts.unexpand
        ydoc = YAML.load_file(filename)
      else
        ydoc = YAML.load(untabify(File.read(filename)))
      end
      ydoc.is_a?(Hash) or raise CommandOptionError.new("#{filename}: root object is not a mapping.")
      intern_hash_keys(ydoc) if opts.intern
      context.update(ydoc)
    elsif filename =~ /\.rb$/
      str = File.read(filename)
      context2 = Erubis::Context.new
      _instance_eval(context2, str)
      context.update(context2)
    else
      CommandOptionError.new("#{filename}: '*.yaml', '*.yml', or '*.rb' required.")
    end
  end
  return context
end