Class: Rack::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/up/rack_builder_patch.rb

Class Method Summary collapse

Class Method Details

.load_file(path, **options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/up/rack_builder_patch.rb', line 3

def self.load_file(path, **options)
  config = ::File.read(path)

  # config = config.slice(/\A#{UTF_8_BOM}/) if config.encoding == Encoding::UTF_8

  if config[/^#\\(.*)/]
    fail "Parsing options from the first comment line is no longer supported: #{path}"
  end

  config = config.sub(/^__END__\n.*\Z/m, '')

  return new_from_string(config, path, **options)
end