instance method
strip_inline_comment
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
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
-
valuereq
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