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