summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2016-06-05 11:44:45 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2016-06-05 11:52:43 -0300
commit4362603c31e4af8889b6b4778a5a3a5f625dc457 (patch)
tree29aa866cd6ed016f533c92ed365acbbcce8f528f
parent5b3a59fd610edab02513fea4c501a0209601f28c (diff)
downloadhighline-4362603c31e4af8889b6b4778a5a3a5f625dc457.tar.gz
Apply (pronto-)rubocop suggestions for PR #197feat_improve_menu
``` $ pronto run lib/highline/menu.rb:371 I: Prefer `to_s` over string interpolation. lib/highline/menu/item.rb:5 I: Missing top-level class documentation comment. lib/highline/menu/item.rb:11 I: Line is too long. [99/80] lib/highline/menu/item.rb:13 I: Line is too long. [91/80] lib/highline/menu/item.rb:28 I: Final newline missing. ```
-rw-r--r--lib/highline/menu.rb2
-rw-r--r--lib/highline/menu/item.rb10
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb
index a942d99..8dc9247 100644
--- a/lib/highline/menu.rb
+++ b/lib/highline/menu.rb
@@ -368,7 +368,7 @@ class HighLine
def map_items_by_index
if @index == :letter
l_index = "`"
- all_items.map { "#{l_index.succ!}" }
+ all_items.map { l_index.succ!.dup }
else
(1..all_items.size).map(&:to_s)
end
diff --git a/lib/highline/menu/item.rb b/lib/highline/menu/item.rb
index 3e670a3..76e1e56 100644
--- a/lib/highline/menu/item.rb
+++ b/lib/highline/menu/item.rb
@@ -1,16 +1,18 @@
class HighLine
class Menu < Question
# Represents an Item of a HighLine::Menu.
-
+ #
class Item
attr_reader :name, :text, :help, :action
#
# @param name [String] The name that is matched against the user input
# @param attributes [Hash] options Hash to tailor menu item to your needs
- # @option attributes text: [String] The text that displays for that choice (defaults to name)
+ # @option attributes text: [String] The text that displays for that
+ # choice (defaults to name)
# @option attributes help: [String] help/hint string to be displayed.
- # @option attributes action: [Block] a block that gets called when choice is selected
+ # @option attributes action: [Block] a block that gets called when choice
+ # is selected
#
def initialize(name, attributes)
@name = name
@@ -25,4 +27,4 @@ class HighLine
end
end
end
-end \ No newline at end of file
+end