mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Replaced ap(object, options = {}) with ap(object, *options)
This commit is contained in:
parent
f49bfd024c
commit
e843081fed
2 changed files with 7 additions and 7 deletions
|
@ -5,10 +5,10 @@
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
module Kernel
|
module Kernel
|
||||||
|
|
||||||
def ai(options = {})
|
def ai(*options)
|
||||||
ap = AwesomePrint::Inspector.new(options)
|
ap = AwesomePrint::Inspector.new(*options)
|
||||||
awesome = ap.awesome self
|
awesome = ap.awesome self
|
||||||
if options[:html]
|
if ap.options[:html]
|
||||||
awesome = "<pre>#{awesome}</pre>"
|
awesome = "<pre>#{awesome}</pre>"
|
||||||
awesome = awesome.html_safe if defined? ActiveSupport
|
awesome = awesome.html_safe if defined? ActiveSupport
|
||||||
end
|
end
|
||||||
|
@ -16,8 +16,8 @@ module Kernel
|
||||||
end
|
end
|
||||||
alias :awesome_inspect :ai
|
alias :awesome_inspect :ai
|
||||||
|
|
||||||
def ap(object, options = {})
|
def ap(object, *options)
|
||||||
puts object.ai(options)
|
puts object.ai(*options)
|
||||||
object unless AwesomePrint.console?
|
object unless AwesomePrint.console?
|
||||||
end
|
end
|
||||||
alias :awesome_print :ap
|
alias :awesome_print :ap
|
||||||
|
|
|
@ -52,7 +52,7 @@ module AwesomePrint
|
||||||
|
|
||||||
AP = :__awesome_print__
|
AP = :__awesome_print__
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(*options)
|
||||||
@options = {
|
@options = {
|
||||||
:indent => 4, # Indent using 4 spaces.
|
:indent => 4, # Indent using 4 spaces.
|
||||||
:index => true, # Display array indices.
|
:index => true, # Display array indices.
|
||||||
|
@ -87,7 +87,7 @@ module AwesomePrint
|
||||||
|
|
||||||
# Merge custom defaults and let explicit options parameter override them.
|
# Merge custom defaults and let explicit options parameter override them.
|
||||||
merge_custom_defaults!
|
merge_custom_defaults!
|
||||||
merge_options!(options)
|
merge_options!(hashify(options))
|
||||||
|
|
||||||
@formatter = AwesomePrint::Formatter.new(self)
|
@formatter = AwesomePrint::Formatter.new(self)
|
||||||
Thread.current[AP] ||= []
|
Thread.current[AP] ||= []
|
||||||
|
|
Loading…
Reference in a new issue