Method: Logger.pp_to_array

Defined in:
lib/utilrb/logger/log_pp.rb

.pp_to_array(object) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/utilrb/logger/log_pp.rb', line 8

def self.pp_to_array(object)
    message =
        begin
            PP.pp(object, "")
        rescue Exception => formatting_error
            begin
              "error formatting object using pretty-printing\n" +
                  object.to_s +
              "\nplease report the formatting error: \n" + 
              formatting_error.full_message
            rescue Exception => formatting_error
              "\nerror formatting object using pretty-printing\n" +
                  formatting_error.full_message
            end
        end

    message.split("\n")
end