Module: WashoutBuilderMethodReturnTypeHelper

Defined in:
app/helpers/washout_builder_method_return_type_helper.rb

Overview

helper that is used to create the return types of methods in HTML documentation

Instance Method Summary collapse

Instance Method Details

#create_html_public_method_return_type(xml, pre, output) ⇒ String

this method will print the return type next to the method name

Parameters:

  • xml (Builder::XmlMarkup)

    the markup builder that is used to insert HTML line breaks or span elements

  • pre (Array)

    The array that contains the html that will be appended to xml

  • output (Array<WashOut::Param>)

    An array of params that need to be displayed, will check the type of each and will display it accordingly if is complex type or not

Returns:

  • (String)

See Also:



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/washout_builder_method_return_type_helper.rb', line 15

def create_html_public_method_return_type(xml, pre, output)
  if !output.nil? && !output[0].blank?
    complex_class = output[0].find_complex_class_name
    if WashoutBuilder::Type::BASIC_TYPES.include?(output[0].type)
      xml.span('class' => 'blue') { |y| y << "#{output[0].type}" }
    else
      html_public_method_complex_type(pre, output, complex_class)
    end
  else
    pre << 'void'
  end
end

#html_public_method_complex_type(pre, output, complex_class) ⇒ void

This method returns an undefined value.

this method will go through each of the arguments print them and then check if we need a spacer after it

Parameters:

  • pre (Array)

    The array that contains the html that will be appended to xml

  • output (Array<WashOut::Param>)

    An array of params that need to be displayed, will check the type of each and will display it accordingly if is complex type or not

  • complex_class (Class)

    the name of the complex class



38
39
40
41
42
43
44
45
46
# File 'app/helpers/washout_builder_method_return_type_helper.rb', line 38

def html_public_method_complex_type(pre, output, complex_class)
  return if complex_class.nil?
  if output[0].multiplied == false
    complex_return_type = "#{complex_class}"
  else
    complex_return_type = "Array of #{complex_class}"
  end
  pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_return_type}</span></a>"
end