instance method strip_inline_comment

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

strip_inline_comment(value)

Strip a trailing “ # comment” from an unquoted value, matching the common .env convention. Quoted values are left untouched so that a “#” inside quotes (e.g. PASS=“a # b”) is preserved, and a “#” that is not preceded by whitespace (e.g. URL=host#frag) stays part of the value.

Parameters

value req
Source
# File activesupport/lib/active_support/dot_env_configuration.rb, line 79
      def strip_inline_comment(value)
        return value if value.start_with?('"', "'")
        value.sub(/\s+#.*\z/, "")
      end

Defined in activesupport/lib/active_support/dot_env_configuration.rb line 79 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::DotEnvConfiguration

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close