diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/highline.rb | 4 | ||||
-rw-r--r-- | lib/highline/builtin_styles.rb | 6 | ||||
-rw-r--r-- | lib/highline/list_renderer.rb | 6 | ||||
-rw-r--r-- | lib/highline/menu.rb | 2 | ||||
-rwxr-xr-x | lib/highline/question.rb | 6 | ||||
-rw-r--r-- | lib/highline/question/answer_converter.rb | 2 | ||||
-rw-r--r-- | lib/highline/statement.rb | 6 | ||||
-rw-r--r-- | lib/highline/string_extensions.rb | 4 | ||||
-rwxr-xr-x | lib/highline/style.rb | 12 | ||||
-rw-r--r-- | lib/highline/template_renderer.rb | 2 | ||||
-rwxr-xr-x | lib/highline/terminal.rb | 6 | ||||
-rw-r--r-- | lib/highline/terminal/ncurses.rb | 2 |
12 files changed, 29 insertions, 29 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index 336949f..4dcdd00 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -191,7 +191,7 @@ class HighLine # Question#character # @see Question#character def agree(yes_or_no_question, character = nil) - ask(yes_or_no_question, ->(yn) { yn.downcase[0] == 'y' }) do |q| + ask(yes_or_no_question, ->(yn) { yn.downcase[0] == "y" }) do |q| q.validate = /\A(?:y(?:es)?|no?)\Z/i q.responses[:not_valid] = 'Please enter "yes" or "no".' q.responses[:ask_on_error] = :question @@ -407,7 +407,7 @@ class HighLine # Outputs indentation with current settings # def indentation - ' ' * @indent_size * @indent_level + " " * @indent_size * @indent_level end # diff --git a/lib/highline/builtin_styles.rb b/lib/highline/builtin_styles.rb index acd06b2..71c2429 100644 --- a/lib/highline/builtin_styles.rb +++ b/lib/highline/builtin_styles.rb @@ -74,11 +74,11 @@ class HighLine BASIC_COLORS.each do |color| bright_color = "BRIGHT_#{color}" colors << bright_color - const_set bright_color + '_STYLE', const_get(color + '_STYLE').bright + const_set bright_color + "_STYLE", const_get(color + "_STYLE").bright light_color = "LIGHT_#{color}" colors << light_color - const_set light_color + '_STYLE', const_get(color + '_STYLE').light + const_set light_color + "_STYLE", const_get(color + "_STYLE").light end # The builtin styles' colors like LIGHT_RED and BRIGHT_BLUE. @@ -115,7 +115,7 @@ class HighLine name.to_s end - style_name = code_name + '_STYLE' + style_name = code_name + "_STYLE" style = Style.rgb(Regexp.last_match(3)) style = style.on if on diff --git a/lib/highline/list_renderer.rb b/lib/highline/list_renderer.rb index be1aa95..8e2d677 100644 --- a/lib/highline/list_renderer.rb +++ b/lib/highline/list_renderer.rb @@ -1,8 +1,8 @@ # coding: utf-8 -require 'highline/template_renderer' -require 'highline/wrapper' -require 'highline/list' +require "highline/template_renderer" +require "highline/wrapper" +require "highline/list" # # This class is a utility for quickly and easily laying out lists diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb index dc8ec93..b1205d8 100644 --- a/lib/highline/menu.rb +++ b/lib/highline/menu.rb @@ -463,7 +463,7 @@ class HighLine elsif selections.is_a?(Hash) value_for_hash_selections(items, selections, details) else - raise ArgumentError, 'selections must be either Array or Hash' + raise ArgumentError, "selections must be either Array or Hash" end end diff --git a/lib/highline/question.rb b/lib/highline/question.rb index b630ef9..f6cccfb 100755 --- a/lib/highline/question.rb +++ b/lib/highline/question.rb @@ -272,10 +272,10 @@ class HighLine # @return [Hash] responses hash def build_responses_new_hash(message_source) { ambiguous_completion: "Ambiguous choice. Please choose one of " + - choice_error_str(message_source) + '.', + choice_error_str(message_source) + ".", invalid_type: "You must enter a valid #{message_source}.", no_completion: "You must choose one of " + - choice_error_str(message_source) + '.', + choice_error_str(message_source) + ".", not_in_range: "Your answer isn't within the expected range " \ "(#{expected_range}).", not_valid: "Your answer isn't valid (must match " \ @@ -608,7 +608,7 @@ class HighLine def choice_error_str(message_source) if message_source.is_a? Array - '[' + message_source.join(', ') + ']' + "[" + message_source.join(", ") + "]" else message_source.inspect end diff --git a/lib/highline/question/answer_converter.rb b/lib/highline/question/answer_converter.rb index 0bd0a78..76558ae 100644 --- a/lib/highline/question/answer_converter.rb +++ b/lib/highline/question/answer_converter.rb @@ -1,6 +1,6 @@ # coding: utf-8 -require 'forwardable' +require "forwardable" class HighLine class Question diff --git a/lib/highline/statement.rb b/lib/highline/statement.rb index 85035e4..35d7961 100644 --- a/lib/highline/statement.rb +++ b/lib/highline/statement.rb @@ -1,8 +1,8 @@ # coding: utf-8 -require 'highline/wrapper' -require 'highline/paginator' -require 'highline/template_renderer' +require "highline/wrapper" +require "highline/paginator" +require "highline/template_renderer" class HighLine # This class handles proper formatting based diff --git a/lib/highline/string_extensions.rb b/lib/highline/string_extensions.rb index 5c50977..1ff56ce 100644 --- a/lib/highline/string_extensions.rb +++ b/lib/highline/string_extensions.rb @@ -35,7 +35,7 @@ class HighLine undef :on if method_defined? :on def on(arg) - color(('on_' + arg.to_s).to_sym) + color(("on_" + arg.to_s).to_sym) end undef :uncolor if method_defined? :uncolor @@ -71,7 +71,7 @@ class HighLine def setup_color_code(*colors) color_code = colors.map do |color| if color.is_a?(Numeric) - format('%02x', color) + format("%02x", color) else color.to_s end diff --git a/lib/highline/style.rb b/lib/highline/style.rb index aaa0385..aeecf4b 100755 --- a/lib/highline/style.rb +++ b/lib/highline/style.rb @@ -106,7 +106,7 @@ class HighLine # HighLine::Style.rgb_hex(9, 10, "11") # => "090a11" def self.rgb_hex(*colors) colors.map do |color| - color.is_a?(Numeric) ? format('%02x', color) : color.to_s + color.is_a?(Numeric) ? format("%02x", color) : color.to_s end.join end @@ -132,7 +132,7 @@ class HighLine # def self.rgb(*colors) hex = rgb_hex(*colors) - name = ('rgb_' + hex).to_sym + name = ("rgb_" + hex).to_sym style = list[name] return style if style @@ -159,7 +159,7 @@ class HighLine (16..231).cover?(ansi_number) parts = (ansi_number - 16). to_s(6). - rjust(3, '0'). + rjust(3, "0"). scan(/./). map { |d| (d.to_i * 255.0 / 6.0).ceil } @@ -180,7 +180,7 @@ class HighLine # @param string [String] # @return [String] def self.uncolor(string) - string.gsub(/\e\[\d+(;\d+)*m/, '') + string.gsub(/\e\[\d+(;\d+)*m/, "") end # Style name @@ -210,7 +210,7 @@ class HighLine @builtin = defn[:builtin] if @rgb hex = self.class.rgb_hex(@rgb) - @name ||= 'rgb_' + hex + @name ||= "rgb_" + hex elsif @list @name ||= @list end @@ -288,7 +288,7 @@ class HighLine # Uses the color as background and return a new style. # @return [Style] def on - new_name = ('on_' + @name.to_s).to_sym + new_name = ("on_" + @name.to_s).to_sym self.class.list[new_name] ||= variant(new_name, increment: 10) end diff --git a/lib/highline/template_renderer.rb b/lib/highline/template_renderer.rb index e77f51a..e948c06 100644 --- a/lib/highline/template_renderer.rb +++ b/lib/highline/template_renderer.rb @@ -1,6 +1,6 @@ # coding: utf-8 -require 'forwardable' +require "forwardable" class HighLine # Renders an erb template taking a {Question} and a {HighLine} instance diff --git a/lib/highline/terminal.rb b/lib/highline/terminal.rb index 5217983..bd8eda1 100755 --- a/lib/highline/terminal.rb +++ b/lib/highline/terminal.rb @@ -32,7 +32,7 @@ class HighLine # Fall back to UnixStty unless terminal - require 'highline/terminal/unix_stty' + require "highline/terminal/unix_stty" terminal = HighLine::Terminal::UnixStty.new(input, output) end @@ -152,12 +152,12 @@ class HighLine # Running on JRuby? def jruby? - defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' + defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" end # Running on Rubinius? def rubinius? - defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' + defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" end # Running on Windows? diff --git a/lib/highline/terminal/ncurses.rb b/lib/highline/terminal/ncurses.rb index b2e206d..72ffac8 100644 --- a/lib/highline/terminal/ncurses.rb +++ b/lib/highline/terminal/ncurses.rb @@ -6,7 +6,7 @@ class HighLine # @note Code migrated +UNTESTED+ from the old code base to the new # terminal api. class NCurses < Terminal - require 'ffi-ncurses' + require "ffi-ncurses" # (see Terminal#raw_no_echo_mode) def raw_no_echo_mode |