Class: PrettyArray

Inherits:
Array show all
Defined in:
lib/pretty_debug.rb

Overview

Inspection

Constant Summary

Constants included from Array::PrettyInspect

Array::PrettyInspect::SingleLength

Instance Method Summary collapse

Methods inherited from Array

#align, #common_affix, #common_prefix

Constructor Details

#initialize(a) ⇒ PrettyArray

Returns a new instance of PrettyArray.



193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/pretty_debug.rb', line 193

def initialize a
  super(a)
  reject!{
    |f, l, m|
    f == __FILE__ or
    m =~ /\A<.*>\z/ #Purpose# Such as `<top (required)>`, `<module:Foo>`.
  }
  reject, select =
  [:@reject, :@select].map{|sym| PrettyDebug.instance_variable_get(sym)}
  reject!{|f, l, m| reject.call(f, m)} rescue nil
  select!{|f, l, m| select.call(f, m)} rescue nil
end

Instance Method Details

#inspectObject



206
# File 'lib/pretty_debug.rb', line 206

def inspect; to_puts.join($/) end

#to_putsObject



205
# File 'lib/pretty_debug.rb', line 205

def to_puts; align.map(&PrettyDebug.instance_variable_get(:@format)) end