Class: Peeky::Renderer::ClassInterfaceRender

Inherits:
Object
  • Object
show all
Defined in:
lib/peeky/renderer/class_interface_render.rb

Overview

Render: Class Interface

Example output: class SampleClassClassInterfaceRender

attr_accessor :a

attr_reader :b

attr_writer :c

def alpha_sort1;                                                                end
def alpha_sort2;                                                                end
def d;                                                                          end
def e(aaa);                                                                     end
def f(aaa, bbb = nil);                                                          end
def g(aaa, bbb = nil, ccc = nil);                                               end
def h(*aaa);                                                                    end
def i(aaa, bbb, *ccc);                                                          end
def j(**aaa);                                                                   end
def k(aaa, *bbb, **ccc);                                                        end
def l(aaa, *bbb, **ccc, &ddd);                                                  end
def m(aaa:);                                                                    end
def n(aaa:, bbb: nil);                                                          end
def p?;                                                                         end
def q!;                                                                         end
def z(aaa, bbb = nil, *ccc, ddd:, eee: nil, **fff, &ggg);                       end

end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_info) ⇒ ClassInterfaceRender

Returns a new instance of ClassInterfaceRender.


36
37
38
# File 'lib/peeky/renderer/class_interface_render.rb', line 36

def initialize(class_info)
  @class_info = class_info
end

Instance Attribute Details

#class_infoObject (readonly)

ClassInfo with information about the class instance to be rendered.


34
35
36
# File 'lib/peeky/renderer/class_interface_render.rb', line 34

def class_info
  @class_info
end

Instance Method Details

#renderObject

Render the class interface


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/peeky/renderer/class_interface_render.rb', line 41

def render
  @indent = ''
  output = []
  output.push render_start
  @indent = '  '
  output += render_accessors
  output += render_readers
  output += render_writers
  output += render_methods
  output.pop if output.last == ''

  @indent = ''
  output.push render_end

  output.join("\n")
end