Class: GirFFI::ClassPrettyPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/gir_ffi-pretty_printer/class_pretty_printer.rb

Overview

Pretty-prints classes

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ ClassPrettyPrinter

Returns a new instance of ClassPrettyPrinter.



6
7
8
# File 'lib/gir_ffi-pretty_printer/class_pretty_printer.rb', line 6

def initialize(klass)
  @klass = klass
end

Instance Method Details

#pretty_printObject



10
11
12
13
14
15
16
17
# File 'lib/gir_ffi-pretty_printer/class_pretty_printer.rb', line 10

def pretty_print
  arr = []
  arr << "class #{@klass.name} < #{@klass.superclass.name}"
  arr << pretty_print_singleton_methods.indent
  arr << pretty_print_instance_methods.indent
  arr << "end"
  arr.join "\n"
end