Class: Peeky::Renderer::MethodSignatureWithDebugRender

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

Overview

Render: Method signature with debug code Stubbed Method Render

Example output:

def simple(first_param)
  puts 'method name: simple'
  puts first_param                    # first_param is a required positional paramater
end

def complex(aaa, bbb = nil, *ccc, ddd:, eee: nil, **fff, &ggg)
  puts 'method name: complex'
  puts aaa                            # aaa is a required positional paramater
  puts bbb                            # bbb is an optional positional paramater
  puts ccc                            # *ccc takes a list of positional params
  puts ddd                            # ddd: is a required named parameter
  puts eee                            # eee: is an optional named parameter
  puts fff                            # **fff takes a list of optional named parameters
  puts ggg                            # &ggg is block with many calling options, example - instance_eval(&block) if block_given?
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_signature, **_opts) ⇒ MethodSignatureWithDebugRender

Returns a new instance of MethodSignatureWithDebugRender.


28
29
30
31
32
# File 'lib/peeky/renderer/method_signature_with_debug_render.rb', line 28

def initialize(method_signature, **_opts)
  @method_signature = method_signature

  @render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
end

Instance Attribute Details

#method_signatureObject (readonly)

Method signature stores a MethodInfo object


26
27
28
# File 'lib/peeky/renderer/method_signature_with_debug_render.rb', line 26

def method_signature
  @method_signature
end

Instance Method Details

#renderObject

Render the method with debug statements for each parameter


35
36
37
# File 'lib/peeky/renderer/method_signature_with_debug_render.rb', line 35

def render
  render_method
end