mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Improve readability by following style rules
These were mostly fixes to Rubocop issues which also helped with readablity of the code.
This commit is contained in:
parent
4db8bb4d1e
commit
fa6f4d3768
2 changed files with 22 additions and 8 deletions
|
@ -5,13 +5,17 @@
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
module AwesomePrint
|
module AwesomePrint
|
||||||
module ActionView
|
module ActionView
|
||||||
|
|
||||||
# Use HTML colors and add default "debug_dump" class to the resulting HTML.
|
# Use HTML colors and add default "debug_dump" class to the resulting HTML.
|
||||||
def ap_debug(object, options = {})
|
def ap_debug(object, options = {})
|
||||||
object.ai(options.merge(:html => true)).sub(/^<pre([\s>])/, '<pre class="debug_dump"\\1')
|
object.ai(
|
||||||
|
options.merge(html: true)
|
||||||
|
).sub(
|
||||||
|
/^<pre([\s>])/,
|
||||||
|
'<pre class="debug_dump"\\1'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :ap, :ap_debug
|
alias ap ap_debug
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,17 @@ Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each do |file|
|
||||||
require file
|
require file
|
||||||
end
|
end
|
||||||
|
|
||||||
ExtVerifier.require_dependencies!(%w{rails active_record action_view
|
ExtVerifier.require_dependencies!(
|
||||||
active_support/all mongoid mongo_mapper ripple nobrainer})
|
%w(
|
||||||
|
rails
|
||||||
|
active_record
|
||||||
|
action_view
|
||||||
|
active_support/all
|
||||||
|
mongoid
|
||||||
|
mongo_mapper
|
||||||
|
ripple nobrainer
|
||||||
|
)
|
||||||
|
)
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'awesome_print'
|
require 'awesome_print'
|
||||||
|
|
||||||
|
@ -42,8 +51,8 @@ RSpec.configure do |config|
|
||||||
mocks.syntax = :expect
|
mocks.syntax = :expect
|
||||||
mocks.verify_partial_doubles = true
|
mocks.verify_partial_doubles = true
|
||||||
end
|
end
|
||||||
if config.files_to_run.one?
|
|
||||||
config.default_formatter = 'doc'
|
config.default_formatter = 'doc' if config.files_to_run.one?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,7 +86,8 @@ def stub_dotfile!
|
||||||
end
|
end
|
||||||
|
|
||||||
def capture!
|
def capture!
|
||||||
standard, $stdout = $stdout, StringIO.new
|
standard = $stdout
|
||||||
|
$stdout = StringIO.new
|
||||||
yield
|
yield
|
||||||
ensure
|
ensure
|
||||||
$stdout = standard
|
$stdout = standard
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue