Module: AwesomePrint

Defined in:
lib/awesome_print/version.rb,
lib/awesome_print/formatter.rb,
lib/awesome_print/inspector.rb,
lib/awesome_print/ext/ripple.rb,
lib/awesome_print/ext/sequel.rb,
lib/awesome_print/ext/mongoid.rb,
lib/awesome_print/ext/ostruct.rb,
lib/awesome_print/ext/nokogiri.rb,
lib/awesome_print/ext/no_brainer.rb,
lib/awesome_print/core_ext/logger.rb,
lib/awesome_print/ext/action_view.rb,
lib/awesome_print/ext/mongo_mapper.rb,
lib/awesome_print/ext/active_record.rb,
lib/awesome_print/ext/active_support.rb

Overview

Copyright © 2010-2013 Michael Dvorkin

Awesome Print 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, Logger, MongoMapper, Mongoid, NoBrainer, Nokogiri, OpenStruct, Ripple, Sequel Classes: Formatter, Inspector

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.defaultsObject

Returns the value of attribute defaults


9
10
11
# File 'lib/awesome_print/inspector.rb', line 9

def defaults
  @defaults
end

.force_colorsObject

Returns the value of attribute force_colors


9
10
11
# File 'lib/awesome_print/inspector.rb', line 9

def force_colors
  @force_colors
end

Class Method Details

.console?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'lib/awesome_print/inspector.rb', line 18

def console?
  !!(defined?(IRB) || defined?(Pry))
end

.force_colors!(value = true) ⇒ Object

Class accessor to force colorized output (ex. forked subprocess where TERM might be dumb).



14
15
16
# File 'lib/awesome_print/inspector.rb', line 14

def force_colors!(value = true)
  @force_colors = value
end

.irb!Object


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/awesome_print/inspector.rb', line 26

def irb!
  return unless defined?(IRB)
  unless IRB.version.include?("DietRB")
    IRB::Irb.class_eval do
      def output_value
        ap @context.last_value
      end
    end
  else # MacRuby
    IRB.formatter = Class.new(IRB::Formatter) do
      def inspect_object(object)
        object.ai
      end
    end.new
  end
end

.pry!Object


43
44
45
46
47
# File 'lib/awesome_print/inspector.rb', line 43

def pry!
  if defined?(Pry)
    Pry.print = proc { |output, value| output.puts value.ai }
  end
end

.rails_console?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/awesome_print/inspector.rb', line 22

def rails_console?
  console? && !!(defined?(Rails::Console) || ENV["RAILS_ENV"])
end

.versionObject


7
8
9
# File 'lib/awesome_print/version.rb', line 7

def self.version
  "1.6.1"
end