module WAB

Web Application Builder

Constants

Error
ParseError
VERSION

Current version of the module.

Public Class Methods

get_export(path) click to toggle source

Returns a file contents from the gem export directory.

# File lib/wab.rb, line 6
def self.get_export(path)
  if path.nil? || path.empty?
    path = '/index.html'
  elsif !path.start_with?('/')
    path = "/#{path}"
  end
  raise ForbiddenError.new(path) if path.include?('..')
  path = File.expand_path("#{__dir__}/../export#{path}")
  begin
    File.open(path) { |f| f.read() }
  rescue Exception
    nil
  end
end