summaryrefslogtreecommitdiff
path: root/lib/highline/string_extensions.rb
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2017-07-02 02:13:31 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2017-07-02 02:13:31 -0300
commit174a063138ab757fd090b2a1b283b786ca573899 (patch)
tree9ca5d8b2ecb861e588dc3c4cf966bfb67c0506ee /lib/highline/string_extensions.rb
parent1c35f06613c0813110b5887b3ab3f2f67457391c (diff)
downloadhighline-174a063138ab757fd090b2a1b283b786ca573899.tar.gz
More manual fixes for rubocop warnings
Diffstat (limited to 'lib/highline/string_extensions.rb')
-rw-r--r--lib/highline/string_extensions.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/highline/string_extensions.rb b/lib/highline/string_extensions.rb
index 95c8bd5..5c50977 100644
--- a/lib/highline/string_extensions.rb
+++ b/lib/highline/string_extensions.rb
@@ -61,15 +61,25 @@ class HighLine
if method.to_s =~ /^(on_)?rgb_([0-9a-fA-F]{6})$/
color(method)
else
- raise NoMethodError, "undefined method `#{method}' for #<#{self.class}:#{format('%#x', object_id)}>"
+ raise NoMethodError, "undefined method `#{method}' for" /
+ "#<#{self.class}:#{format('%#x', object_id)}>"
end
end
private
def setup_color_code(*colors)
- color_code = colors.map { |color| color.is_a?(Numeric) ? format('%02x', color) : color.to_s }.join
- raise "Bad RGB color #{colors.inspect}" unless color_code =~ /^[a-fA-F0-9]{6}/
+ color_code = colors.map do |color|
+ if color.is_a?(Numeric)
+ format('%02x', color)
+ else
+ color.to_s
+ end
+ end.join
+
+ raise "Bad RGB color #{colors.inspect}" unless
+ color_code =~ /^[a-fA-F0-9]{6}/
+
color_code
end
end