diff options
author | Grégoire Seux <kamaradclimber@gmail.com> | 2017-06-05 09:41:37 +0200 |
---|---|---|
committer | Grégoire Seux <g.seux@criteo.com> | 2017-09-17 16:21:17 +0200 |
commit | 6ce923e1eea79469d2e5e2f3487c21afb6c73f80 (patch) | |
tree | 351e2df0a8c21bd2a887aa9a0c7a002905e24ae2 /lib | |
parent | 2070d853630104e6cad1882b81d6308911baa1d0 (diff) | |
download | mixlib-cli-6ce923e1eea79469d2e5e2f3487c21afb6c73f80.tar.gz |
Avoid modification on possibly frozen string
Most users are defining option description with string literal. Starting from ruby 2.3, rubocop starts advocating to set `# frozen_string_literal: true` magic comment.
Before this patch, this would raise an error related to modification of frozen string.
Change-Id: Ia2561296a5855e639a4972368ab00ccbccd7cb12
Signed-off-by: Grégoire Seux <g.seux@criteo.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mixlib/cli.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/mixlib/cli.rb b/lib/mixlib/cli.rb index 3c40a27..ab34b56 100644 --- a/lib/mixlib/cli.rb +++ b/lib/mixlib/cli.rb @@ -311,9 +311,10 @@ module Mixlib arguments << opt_setting[:short] if opt_setting.has_key?(:short) arguments << opt_setting[:long] if opt_setting.has_key?(:long) if opt_setting.has_key?(:description) - description = opt_setting[:description] + description = opt_setting[:description].dup description << " (required)" if opt_setting[:required] description << " (included in ['#{opt_setting[:in].join("', '")}'])" if opt_setting[:in] + opt_setting[:description] = description arguments << description end |