Class: Struct

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

Instance Method Summary collapse

Instance Method Details

#pretty_print(q) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/pp-colour/struct.rb', line 2

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



16
17
18
# File 'lib/pp-colour/struct.rb', line 16

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