summaryrefslogtreecommitdiff
path: root/examples/ansi_colors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ansi_colors.rb')
-rw-r--r--examples/ansi_colors.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/examples/ansi_colors.rb b/examples/ansi_colors.rb
index 2a86e38..677ca45 100644
--- a/examples/ansi_colors.rb
+++ b/examples/ansi_colors.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+# encoding: utf-8
# ansi_colors.rb
#
@@ -9,19 +10,13 @@ require "rubygems"
require "highline/import"
# Supported color sequences.
-colors = %w{black red green yellow blue magenta cyan white}
+colors = %w[black red green yellow blue magenta cyan white]
# Using color() with symbols.
colors.each_with_index do |c, i|
say("This should be <%= color('#{c}', :#{c}) %>!")
- if i == 0
- say( "This should be " +
- "<%= color('white on #{c}', :white, :on_#{c}) %>!")
- else
- say( "This should be " +
- "<%= color( '#{colors[i - 1]} on #{c}',
- :#{colors[i - 1]}, :on_#{c} ) %>!")
- end
+ say("This should be <%= color('#{colors[i - 1]} on #{c}', \
+ :#{colors[i - 1]}, :on_#{c} ) %>!")
end
# Using color with constants.
@@ -32,7 +27,7 @@ say("This should be <%= color('underlined', UNDERLINE) %>!")
say("This might even <%= BLINK %>blink<%= CLEAR %>!")
# It even works with list wrapping.
-erb_digits = %w{Zero One Two Three Four} +
+erb_digits = %w[Zero One Two Three Four] +
["<%= color('Five', :blue) %%>"] +
- %w{Six Seven Eight Nine}
+ %w[Six Seven Eight Nine]
say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>")