Class: Data
Overview
:nodoc:
Instance Method Summary collapse
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#pretty_print_cycle(q) ⇒ Object
:nodoc:.
Instance Method Details
#pretty_print(q) ⇒ Object
:nodoc:
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
# File 'lib/pp.rb', line 495 def pretty_print(q) # :nodoc: class_name = PP.mcall(self, Kernel, :class).name class_name = " #{class_name}" if class_name q.group(1, "#<data#{class_name}", '>') { members = PP.mcall(self, Kernel, :class).members values = [] members.select! do |member| begin values << __send__(member) true rescue NoMethodError false end end q.seplist(members.zip(values), lambda { q.text "," }) {|(member, value)| q.breakable q.text member.to_s q.text '=' q.group(1) { q.breakable '' q.pp value } } } end |
#pretty_print_cycle(q) ⇒ Object
:nodoc:
523 524 525 |
# File 'lib/pp.rb', line 523 def pretty_print_cycle(q) # :nodoc: q.text sprintf("#<data %s:...>", PP.mcall(self, Kernel, :class).name) end |