diff --git a/lib/puma/plugin/runtime_env.rb b/lib/puma/plugin/runtime_env.rb index 4639392..36d5af4 100644 --- a/lib/puma/plugin/runtime_env.rb +++ b/lib/puma/plugin/runtime_env.rb @@ -5,12 +5,10 @@ # Graciously, from https://github.com/rails/rails/blob/94b5cd3a20edadd6f6b8cf0bdf1a4d4919df86cb/activesupport/lib/active_support/inflector/methods.rb#L69 def camelize(term, uppercase_first_letter = true) string = term.to_s - if uppercase_first_letter - string = string.sub(/^[a-z\d]*/) { |match| inflections.acronyms[match] || match.capitalize } - else - string = string.sub(inflections.acronyms_camelize_regex) { |match| match.downcase } - end - string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" } + + string = string.sub(/^[a-z\d]*/) { |match| match.capitalize } + + string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" } string.gsub!("/".freeze, "::".freeze) string end @@ -27,8 +25,8 @@ def config(c) return end - adapter = "Puma::RuntimeEnv::#{camelize(adapter_name)}".new - poll_interval = Integer(ENV["PUMA_RUNTIME_ENV_INTERVAL"]) rescue 5 + adapter = Puma::RuntimeEnv.const_get("#{camelize(adapter_name)}").new + poll_interval = Integer(ENV["PUMA_RUNTIME_ENV_INTERVAL"]) rescue 10 restricted_envs = ["PUMA_RUNTIME_ENV"] other_restricted_envs = ENV.fetch("PUMA_RUNTIME_ENV_RESTRICTED", []) diff --git a/puma-runtime_env.gemspec b/puma-runtime_env.gemspec index 3dd0bb7..d89f21d 100644 --- a/puma-runtime_env.gemspec +++ b/puma-runtime_env.gemspec @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "puma-runtime_env" - spec.version = "0.0.1" + spec.version = "0.0.2" spec.authors = ["shaker"] spec.email = ["shakerislam@gmail.com"]