Skip to content

Commit dc156a4

Browse files
committed
Fix indentation, etc.
1 parent 009b7a2 commit dc156a4

File tree

13 files changed

+38
-38
lines changed

13 files changed

+38
-38
lines changed

lib/thor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def subcommand(subcommand, subcommand_class)
226226

227227
define_method(subcommand) do |*args|
228228
args, opts = Thor::Arguments.split(args)
229-
args.unshift("help") if opts.include? "--help" or opts.include? "-h"
229+
args.unshift('help') if opts.include? '--help' or opts.include? '-h'
230230
invoke subcommand_class, args, opts, :invoked_via_subcommand => true, :class_options => options
231231
end
232232
end

lib/thor/actions/file_manipulation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ def remove_file(path, config = {})
292292
end
293293
alias_method :remove_dir, :remove_file
294294

295-
attr_accessor :output_buffer
296-
private :output_buffer, :output_buffer=
295+
attr_accessor :output_buffer
296+
private :output_buffer, :output_buffer=
297297

298298
private
299299

lib/thor/actions/inject_into_file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def initialize(base, destination, data, config)
3838
super(base, destination, {:verbose => true}.merge(config))
3939

4040
@behavior, @flag = if @config.key?(:after)
41-
[:after, @config.delete(:after)]
41+
[:after, @config.delete(:after)]
4242
else
4343
[:before, @config.delete(:before)]
4444
end

lib/thor/line_editor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Thor
55
module LineEditor
6-
def self.readline(prompt, options={})
6+
def self.readline(prompt, options = {})
77
best_available.new(prompt, options).readline
88
end
99

lib/thor/line_editor/basic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def readline
1717
get_input
1818
end
1919

20-
private
20+
private
2121

2222
def get_input
2323
if echo?

lib/thor/line_editor/readline.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ def readline
2323
end
2424
end
2525

26-
private
26+
private
2727

2828
def add_to_history?
2929
options.fetch(:add_to_history, true)
3030
end
3131

3232
def completion_proc
3333
if use_path_completion?
34-
Proc.new { |text| PathCompletion.new(text).matches }
34+
proc { |text| PathCompletion.new(text).matches }
3535
elsif completion_options.any?
36-
Proc.new do |text|
36+
proc do |text|
3737
completion_options.select { |option| option.start_with?(text) }
3838
end
3939
end
@@ -59,7 +59,7 @@ def matches
5959
relative_matches
6060
end
6161

62-
private
62+
private
6363

6464
def relative_matches
6565
absolute_matches.map { |path| path.sub(base_path, '') }

lib/thor/parser/arguments.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ def parse_numeric(name)
132132
end
133133

134134
value = $&.index('.') ? shift.to_f : shift.to_i
135-
if @switches.is_a?(Hash) && switch = @switches[name]
136-
if switch.enum && !switch.enum.include?(value)
137-
raise MalformattedArgumentError, "Expected '#{name}' to be one of #{switch.enum.join(', ')}; got #{value}"
138-
end
135+
if @switches.is_a?(Hash) && switch = @switches[name]
136+
if switch.enum && !switch.enum.include?(value)
137+
fail MalformattedArgumentError, "Expected '#{name}' to be one of #{switch.enum.join(', ')}; got #{value}"
139138
end
139+
end
140140
value
141141
end
142142

lib/thor/shell/basic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def set_color(string, *args) #:nodoc:
291291
protected
292292

293293
def prepare_message(message, *color)
294-
spaces = " " * padding
294+
spaces = ' ' * padding
295295
spaces + set_color(message.to_s, *color)
296296
end
297297

spec/line_editor/readline_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
it 'provides tab completion when given a limited_to option' do
3939
expect(::Readline).to receive(:readline)
4040
expect(::Readline).to receive(:completion_proc=) do |proc|
41-
expect(proc.call('')).to eq ['Apples', 'Chicken', 'Chocolate']
42-
expect(proc.call('Ch')).to eq ['Chicken', 'Chocolate']
41+
expect(proc.call('')).to eq %w[Apples Chicken Chocolate]
42+
expect(proc.call('Ch')).to eq %w[Chicken Chocolate]
4343
expect(proc.call('Chi')).to eq ['Chicken']
4444
end
4545

46-
editor = Thor::LineEditor::Readline.new('Best food: ', :limited_to => ['Apples', 'Chicken', 'Chocolate'])
46+
editor = Thor::LineEditor::Readline.new('Best food: ', :limited_to => %w[Apples Chicken Chocolate])
4747
editor.readline
4848
end
4949

spec/parser/options_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ def remaining
292292
it "raises error when value isn't in enum" do
293293
enum = %w[apple banana]
294294
create :fruit => Thor::Option.new('fruit', :type => :string, :enum => enum)
295-
expect{ parse('--fruit', 'orange') }.to raise_error(Thor::MalformattedArgumentError,
296-
"Expected '--fruit' to be one of #{enum.join(', ')}; got orange")
295+
expect { parse('--fruit', 'orange') }.to raise_error(Thor::MalformattedArgumentError,
296+
"Expected '--fruit' to be one of #{enum.join(', ')}; got orange")
297297
end
298298
end
299299

@@ -405,8 +405,8 @@ def remaining
405405
it "raises error when value isn't in enum" do
406406
enum = [1, 2]
407407
create :limit => Thor::Option.new('limit', :type => :numeric, :enum => enum)
408-
expect{ parse('--limit', '3') }.to raise_error(Thor::MalformattedArgumentError,
409-
"Expected '--limit' to be one of #{enum.join(', ')}; got 3")
408+
expect { parse('--limit', '3') }.to raise_error(Thor::MalformattedArgumentError,
409+
"Expected '--limit' to be one of #{enum.join(', ')}; got 3")
410410
end
411411
end
412412

0 commit comments

Comments
 (0)