Files

AwesomePrintActionView

 Copyright (c) 2010 Michael Dvorkin

 Awesome Print is freely distributable under the terms of MIT license.
 See LICENSE file or http://www.opensource.org/licenses/mit-license.php

Public Class Methods

included(base) click to toggle source
    # File lib/ap/mixin/action_view.rb, line 8
 8:   def self.included(base)
 9:     unless base.const_defined?(:AP_ANSI_TO_HTML)
10:       hash = {} # Build ANSI => HTML color map.
11:       [ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i|
12:         hash["\0033[1;#{30+i}m"] = color
13:       end
14:       [ :black, :darkred, :darkgreen, :brown, :navy, :darkmagenta, :darkcyan, :slategray ].each_with_index do |color, i|
15:         hash["\0033[0;#{30+i}m"] = color
16:       end
17:       base.const_set(:AP_ANSI_TO_HTML, hash.freeze)
18:     end
19:   end

Public Instance Methods

ap(object, options = {}) click to toggle source
Alias for: ap_debug
ap_debug(object, options = {}) click to toggle source
    # File lib/ap/mixin/action_view.rb, line 21
21:   def ap_debug(object, options = {})
22:     formatted = h(object.ai(options))
23: 
24:     unless options[:plain]
25:       self.class::AP_ANSI_TO_HTML.each do |key, value|
26:         formatted.gsub!(key, %<font color="#{value}">|)
27:       end
28:       formatted.gsub!("\0033[0m", "</font>")
29:     end
30: 
31:     content_tag(:pre, formatted, :class => "debug_dump")
32:   end
Also aliased as: ap

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.