More Rubocop changes

This commit is contained in:
Maruno17
2022-02-13 00:57:54 +00:00
parent cca5989746
commit f68e699cc9
108 changed files with 708 additions and 808 deletions

View File

@@ -77,8 +77,8 @@ module Console
# list item
def echo_li(msg, pad = 0, color = :brown)
echo markup_style(' -> ', text: color)
pad = (pad - msg.length) > 0 ? '.' * (pad - msg.length) : ''
echo markup_style(" -> ", text: color)
pad = (pad - msg.length) > 0 ? "." * (pad - msg.length) : ""
echo markup(msg + pad)
end
@@ -106,18 +106,18 @@ module Console
# status output
def echo_status(status)
if status
echoln markup_style('OK', text: :green)
echoln markup_style("OK", text: :green)
else
echoln markup_style('FAIL', text: :red)
echoln markup_style("FAIL", text: :red)
end
end
# completion output
def echo_done(status)
if status
echoln markup_style('done', text: :green)
echoln markup_style("done", text: :green)
else
echoln markup_style('error', text: :red)
echoln markup_style("error", text: :red)
end
end
@@ -126,39 +126,39 @@ module Console
#-----------------------------------------------------------------------------
def string_colors
{
default: '38', black: '30', red: '31', green: '32', brown: '33',
blue: '34', purple: '35', cyan: '36', gray: '37',
dark_gray: '1;30', light_red: '1;31', light_green: '1;32', yellow: '1;33',
light_blue: '1;34', light_purple: '1;35', light_cyan: '1;36', white: '1;37'
default: "38", black: "30", red: "31", green: "32", brown: "33",
blue: "34", purple: "35", cyan: "36", gray: "37",
dark_gray: "1;30", light_red: "1;31", light_green: "1;32", yellow: "1;33",
light_blue: "1;34", light_purple: "1;35", light_cyan: "1;36", white: "1;37"
}
end
def background_colors
{
default: '0', black: '40', red: '41', green: '42', brown: '43',
blue: '44', purple: '45', cyan: '46', gray: '47',
dark_gray: '100', light_red: '101', light_green: '102', yellow: '103',
light_blue: '104', light_purple: '105', light_cyan: '106', white: '107'
default: "0", black: "40", red: "41", green: "42", brown: "43",
blue: "44", purple: "45", cyan: "46", gray: "47",
dark_gray: "100", light_red: "101", light_green: "102", yellow: "103",
light_blue: "104", light_purple: "105", light_cyan: "106", white: "107"
}
end
def font_options
{
bold: '1', dim: '2', italic: '3', underline: '4', reverse: '7',
hidden: '8'
bold: "1", dim: "2", italic: "3", underline: "4", reverse: "7",
hidden: "8"
}
end
# Text markup that turns text between them a certain color
def markup_colors
{
'`' => :cyan, '"' => :purple, "'" => :purple, '$' => :green, '~' => :red
"`" => :cyan, '"' => :purple, "'" => :purple, "$" => :green, "~" => :red
}
end
def markup_options
{
'__' => :underline, '*' => :bold, '|' => :italic
"__" => :underline, "*" => :bold, "|" => :italic
}
end
@@ -169,9 +169,9 @@ module Console
code_bg = background_colors[bg]
# get options
options_pool = options.select { |key, val| font_options.key?(key) && val }
markup_pool = options_pool.keys.map { |opt| font_options[opt] }.join(';').squeeze
markup_pool = options_pool.keys.map { |opt| font_options[opt] }.join(";").squeeze
# return formatted string
"\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(';')
"\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(";")
end
#-----------------------------------------------------------------------------

View File

@@ -40,11 +40,11 @@ class Module
raise ArgumentError, "#{class_name} does not have method #{aliased_method} defined"
end
delimiter = class_method ? '.' : '#'
delimiter = class_method ? "." : "#"
target.define_method(name) do |*args, **kvargs|
alias_name = sprintf('%s%s%s', class_name, delimiter, name)
aliased_method_name = sprintf('%s%s%s', class_name, delimiter, aliased_method)
alias_name = sprintf("%s%s%s", class_name, delimiter, name)
aliased_method_name = sprintf("%s%s%s", class_name, delimiter, aliased_method)
Deprecation.warn_method(alias_name, removal_in, aliased_method_name)
method(aliased_method).call(*args, **kvargs)
end