Class: Struct

Inherits:
Object show all
Defined in:
lib/pp.rb

Direct Known Subclasses

PPCycleTest::S, PPTest::OverriddenStruct

Instance Method Summary collapse

Instance Method Details

#pretty_print(q) ⇒ Object



331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/pp.rb', line 331

def pretty_print(q)
  q.group(1, '#<struct ' + PP.mcall(self, Kernel, :class).name, '>') {
    q.seplist(PP.mcall(self, Struct, :members), lambda { q.text "," }) {|member|
      q.breakable
      q.text member.to_s
      q.text '='
      q.group(1) {
        q.breakable ''
        q.pp self[member]
      }
    }
  }
end

#pretty_print_cycle(q) ⇒ Object



345
346
347
# File 'lib/pp.rb', line 345

def pretty_print_cycle(q)
  q.text sprintf("#<struct %s:...>", PP.mcall(self, Kernel, :class).name)
end