Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Get rid of print_list

  • Loading branch information...
commit 9f6073afe9d743c534cc85761341ceac548d9a2a 1 parent 094cd62
@josevalim josevalim authored
View
2  lib/thor/shell.rb
@@ -22,7 +22,7 @@ def self.shell=(klass)
end
module Shell
- SHELL_DELEGATED_METHODS = [:ask, :yes?, :no?, :say, :say_status, :print_list, :print_table]
+ SHELL_DELEGATED_METHODS = [:ask, :yes?, :no?, :say, :say_status, :print_table]
# Add shell to initialize config values.
#
View
24 lib/thor/shell/basic.rb
@@ -75,30 +75,6 @@ def no?(statement, color=nil)
!yes?(statement, color)
end
- # Prints a list of items.
- #
- # ==== Parameters
- # list<Array[String, String, ...]>
- #
- # ==== Options
- # mode:: Can be :rows or :inline. Defaults to :rows.
- # ident:: Ident each item with the value given.
- #
- def print_list(list, options={})
- return if list.empty?
-
- ident = " " * (options[:ident] || 0)
- content = case options[:mode]
- when :inline
- last = list.pop
- "#{list.join(", ")}, and #{last}"
- else # rows
- ident + list.join("\n#{ident}")
- end
-
- $stdout.puts content
- end
-
# Prints a table.
#
# ==== Parameters
View
22 spec/shell/basic_spec.rb
@@ -96,28 +96,6 @@ def shell
end
end
- describe "#print_list" do
- before(:each) do
- @list = ["abc", "#123", "first three"]
- end
-
- it "prints a list" do
- content = capture(:stdout){ shell.print_list(@list) }
- content.must == <<-LIST
-abc
-#123
-first three
-LIST
- end
-
- it "prints a list inline" do
- content = capture(:stdout){ shell.print_list(@list, :mode => :inline) }
- content.must == <<-LIST
-abc, #123, and first three
-LIST
- end
- end
-
describe "#print_table" do
before(:each) do
@table = []

0 comments on commit 9f6073a

Please sign in to comment.
Something went wrong with that request. Please try again.