Module: AmazingPrint
- Defined in:
- lib/amazing_print/version.rb,
lib/amazing_print/colorize.rb,
lib/amazing_print/formatter.rb,
lib/amazing_print/inspector.rb,
lib/amazing_print/ext/ripple.rb,
lib/amazing_print/ext/sequel.rb,
lib/amazing_print/formatters.rb,
lib/amazing_print/indentator.rb,
lib/amazing_print/ext/mongoid.rb,
lib/amazing_print/ext/ostruct.rb,
lib/amazing_print/ext/nokogiri.rb,
lib/amazing_print/ext/nobrainer.rb,
lib/amazing_print/core_ext/logger.rb,
lib/amazing_print/custom_defaults.rb,
lib/amazing_print/ext/action_view.rb,
lib/amazing_print/ext/mongo_mapper.rb,
lib/amazing_print/ext/active_record.rb,
lib/amazing_print/ext/active_support.rb,
lib/amazing_print/formatters/dir_formatter.rb,
lib/amazing_print/formatters/base_formatter.rb,
lib/amazing_print/formatters/file_formatter.rb,
lib/amazing_print/formatters/hash_formatter.rb,
lib/amazing_print/formatters/array_formatter.rb,
lib/amazing_print/formatters/class_formatter.rb,
lib/amazing_print/formatters/method_formatter.rb,
lib/amazing_print/formatters/object_formatter.rb,
lib/amazing_print/formatters/simple_formatter.rb,
lib/amazing_print/formatters/struct_formatter.rb
Overview
Copyright © 2010-2016 Michael Dvorkin and contributors
AmazingPrint is freely distributable under the terms of MIT license. See LICENSE file or www.opensource.org/licenses/mit-license.php
Defined Under Namespace
Modules: ActionView, ActiveRecord, ActiveSupport, Colorize, Formatters, Logger, MongoMapper, Mongoid, NoBrainer, Nokogiri, OpenStruct, Ripple, Sequel Classes: Formatter, Indentator, Inspector
Class Attribute Summary collapse
-
.defaults ⇒ Object
Returns the value of attribute defaults.
-
.force_colors ⇒ Object
Returns the value of attribute force_colors.
Class Method Summary collapse
- .console? ⇒ Boolean
- .diet_rb ⇒ Object
-
.force_colors!(colors: true) ⇒ Object
Class accessor to force colorized output (ex. forked subprocess where TERM might be dumb).
- .irb! ⇒ Object
- .pry! ⇒ Object
- .rails_console? ⇒ Boolean
-
.reload! ⇒ Object
Reload the cached custom configurations.
- .usual_rb ⇒ Object
- .version ⇒ Object
Class Attribute Details
.defaults ⇒ Object
Returns the value of attribute defaults.
5 6 7 |
# File 'lib/amazing_print/custom_defaults.rb', line 5 def defaults @defaults end |
.force_colors ⇒ Object
Returns the value of attribute force_colors.
5 6 7 |
# File 'lib/amazing_print/custom_defaults.rb', line 5 def force_colors @force_colors end |
Class Method Details
.console? ⇒ Boolean
14 15 16 |
# File 'lib/amazing_print/custom_defaults.rb', line 14 def console? boolean(defined?(IRB) || defined?(Pry)) end |
.diet_rb ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/amazing_print/custom_defaults.rb', line 22 def diet_rb IRB.formatter = Class.new(IRB::Formatter) do def inspect_object(object) object.ai end end.new end |
.force_colors!(colors: true) ⇒ Object
Class accessor to force colorized output (ex. forked subprocess where TERM might be dumb).
10 11 12 |
# File 'lib/amazing_print/custom_defaults.rb', line 10 def force_colors!(colors: true) @force_colors = colors end |
.irb! ⇒ Object
40 41 42 43 44 |
# File 'lib/amazing_print/custom_defaults.rb', line 40 def irb! return unless defined?(IRB) IRB.version.include?('DietRB') ? diet_rb : usual_rb end |
.pry! ⇒ Object
46 47 48 |
# File 'lib/amazing_print/custom_defaults.rb', line 46 def pry! Pry.print = proc { |output, value| output.puts value.ai } if defined?(Pry) end |
.rails_console? ⇒ Boolean
18 19 20 |
# File 'lib/amazing_print/custom_defaults.rb', line 18 def rails_console? console? && boolean(defined?(Rails::Console) || ENV['RAILS_ENV']) end |
.reload! ⇒ Object
Reload the cached custom configurations.
53 54 55 |
# File 'lib/amazing_print/custom_defaults.rb', line 53 def reload! AmazingPrint::Inspector.reload_dotfile end |
.usual_rb ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/amazing_print/custom_defaults.rb', line 30 def usual_rb IRB::Irb.class_eval do def output_value(_omit = false) # rubocop:disable Style/OptionalBooleanParameter ap @context.last_value rescue NoMethodError puts "(Object doesn't support #ai)" end end end |
.version ⇒ Object
9 10 11 |
# File 'lib/amazing_print/version.rb', line 9 def self.version '1.4.0' end |