Class: Peeky::Renderer::ClassInterfaceYardRender
- Inherits:
-
Object
- Object
- Peeky::Renderer::ClassInterfaceYardRender
- Defined in:
- lib/peeky/renderer/class_interface_yard_render.rb
Overview
Render: Class Interface with YARD documentation
Instance Attribute Summary collapse
-
#class_info ⇒ Object
readonly
ClassInfo with information about the class instance to be rendered.
-
#default_param_type ⇒ Object
Default param type when documenting positional and named parameters.
-
#default_splat_param_type ⇒ Object
Default param type when documenting splat *parameters.
-
#indent ⇒ Object
Indentation prefix as a string, defaults to ''.
Instance Method Summary collapse
-
#initialize(class_info) ⇒ ClassInterfaceYardRender
constructor
A new instance of ClassInterfaceYardRender.
-
#render ⇒ Object
Render the class interface with YARD documentation.
Constructor Details
#initialize(class_info) ⇒ ClassInterfaceYardRender
Returns a new instance of ClassInterfaceYardRender.
27 28 29 30 31 32 |
# File 'lib/peeky/renderer/class_interface_yard_render.rb', line 27 def initialize(class_info) @class_info = class_info @indent = '' @default_param_type = 'String' @default_splat_param_type = 'Object' end |
Instance Attribute Details
#class_info ⇒ Object (readonly)
ClassInfo with information about the class instance to be rendered.
25 26 27 |
# File 'lib/peeky/renderer/class_interface_yard_render.rb', line 25 def class_info @class_info end |
#default_param_type ⇒ Object
Default param type when documenting positional and named parameters. Defaults to <String>
18 19 20 |
# File 'lib/peeky/renderer/class_interface_yard_render.rb', line 18 def default_param_type @default_param_type end |
#default_splat_param_type ⇒ Object
Default param type when documenting splat *parameters. Defaults to <Object>
22 23 24 |
# File 'lib/peeky/renderer/class_interface_yard_render.rb', line 22 def default_splat_param_type @default_splat_param_type end |
#indent ⇒ Object
Indentation prefix as a string, defaults to ''
If you were writing a class into a file with an existing module, you may set the indent to ' ' if you wanted this render to indent by two spaces
14 15 16 |
# File 'lib/peeky/renderer/class_interface_yard_render.rb', line 14 def indent @indent end |
Instance Method Details
#render ⇒ Object
Render the class interface with YARD documentation
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/peeky/renderer/class_interface_yard_render.rb', line 35 def render output = [] output.push render_start @indent += ' ' output += (render_accessors + render_readers + render_writers + render_methods) output.pop if output.last == '' @indent = @indent[0..-3] output.push render_end output.join("\n") end |