rubocop: fix Style/DocumentDynamicEvalDefinition
This commit is contained in:
parent
f9fec9bdc7
commit
215a84e328
@ -8,11 +8,11 @@ class Module
|
||||
|
||||
attrs.each do |attr|
|
||||
module_eval <<-EOS, file, line
|
||||
def #{attr}(val=nil)
|
||||
@#{attr} ||= nil
|
||||
return @#{attr} if val.nil?
|
||||
@#{attr} = val
|
||||
end
|
||||
def #{attr}(val=nil) # def prefix(val=nil)
|
||||
@#{attr} ||= nil # @prefix ||= nil
|
||||
return @#{attr} if val.nil? # return @prefix if val.nil?
|
||||
@#{attr} = val # @prefix = val
|
||||
end # end
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
@ -58,9 +58,9 @@ module RuboCop
|
||||
|
||||
Constants::STANZA_ORDER.each do |stanza_name|
|
||||
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||
def #{stanza_name}?
|
||||
stanza_name == :#{stanza_name}
|
||||
end
|
||||
def #{stanza_name}? # def url?
|
||||
stanza_name == :#{stanza_name} # stanza_name == :url
|
||||
end # end
|
||||
RUBY
|
||||
end
|
||||
end
|
||||
|
||||
@ -22,7 +22,7 @@ module Test
|
||||
return super(block) unless @tty
|
||||
|
||||
colored_tty_block = lambda do
|
||||
instance_eval("$#{@output}", __FILE__, __LINE__).extend(Module.new do
|
||||
instance_eval("$#{@output} # $stdout", __FILE__, __LINE__).extend(Module.new do
|
||||
def tty?
|
||||
true
|
||||
end
|
||||
@ -36,17 +36,17 @@ module Test
|
||||
|
||||
uncolored_tty_block = lambda do
|
||||
instance_eval <<-EOS, __FILE__, __LINE__ + 1
|
||||
begin
|
||||
captured_stream = StringIO.new
|
||||
begin # begin
|
||||
captured_stream = StringIO.new # captured_stream = StringIO.new
|
||||
|
||||
original_stream = $#{@output}
|
||||
$#{@output} = captured_stream
|
||||
original_stream = $#{@output} # original_stream = $stdout
|
||||
$#{@output} = captured_stream # $stdout = captured_stream
|
||||
|
||||
colored_tty_block.call
|
||||
ensure
|
||||
$#{@output} = original_stream
|
||||
$#{@output}.print Tty.strip_ansi(captured_stream.string)
|
||||
end
|
||||
colored_tty_block.call # colored_tty_block.call
|
||||
ensure # ensure
|
||||
$#{@output} = original_stream # $stdout = original_stream
|
||||
$#{@output}.print Tty.strip_ansi(captured_stream.string) # $stdout.print Tty.strip_ansi(captured_stream.string)
|
||||
end # end
|
||||
EOS
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user