Synced with Octolux master.

Renamed the master branch to main
This commit is contained in:
AndyWhittaker 2021-04-30 16:17:50 +01:00
parent 725761ca02
commit 33b373bcdc
2 changed files with 18 additions and 0 deletions

View File

@ -9,6 +9,7 @@ require 'bundler/setup'
require 'logger'
require 'inifile'
require_relative 'lib/inifile' # monkey-patch :(
require 'zeitwerk'
LOGGER = Logger.new(STDOUT)

17
lib/inifile.rb Normal file
View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class IniFile
class Parser
def typecast(value)
case value
when /\Atrue\z/i then true
when /\Afalse\z/i then false
when /\A\s*\z/i then nil
else
# Monkey-patch to avoid converting contents of the inifile into
# Integers or Floats. Just leave everything as Strings.
unescape_value(value)
end
end
end
end