module AwesomePrint
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Copyright © 2010-2016 Michael Dvorkin and contributors
Awesome Print is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Attributes
Public Class Methods
# File lib/awesome_print/custom_defaults.rb, line 12 def console? boolean(defined?(IRB) || defined?(Pry)) end
# File lib/awesome_print/custom_defaults.rb, line 20 def diet_rb IRB.formatter = Class.new(IRB::Formatter) do def inspect_object(object) object.ai end end.new end
Class
accessor to force colorized output (ex. forked subprocess where TERM might be dumb).
# File lib/awesome_print/custom_defaults.rb, line 8 def force_colors!(value = true) @force_colors = value end
# File lib/awesome_print/custom_defaults.rb, line 22 def inspect_object(object) object.ai end
# File lib/awesome_print/custom_defaults.rb, line 38 def irb! return unless defined?(IRB) IRB.version.include?('DietRB') ? diet_rb : usual_rb end
# File lib/awesome_print/custom_defaults.rb, line 30 def output_value(*args) ap @context.last_value rescue NoMethodError puts "(Object doesn't support #ai)" end
# File lib/awesome_print/custom_defaults.rb, line 44 def pry! Pry.print = proc { |output, value| output.puts value.ai } if defined?(Pry) end
# File lib/awesome_print/custom_defaults.rb, line 16 def rails_console? console? && boolean(defined?(Rails::Console) || ENV['RAILS_ENV']) end
# File lib/awesome_print/custom_defaults.rb, line 28 def usual_rb IRB::Irb.class_eval do def output_value(*args) ap @context.last_value rescue NoMethodError puts "(Object doesn't support #ai)" end end end
# File lib/awesome_print/version.rb, line 7 def self.version '1.9.2' end
Private Class Methods
Takes a value and returns true unless it is false or nil This is an alternative to the less readable !!(value) github.com/bbatsov/ruby-style-guide#no-bang-bang
# File lib/awesome_print/custom_defaults.rb, line 53 def boolean(value) value ? true : false end