Module: WashoutBuilderMethodListHelper

Includes:
WashoutBuilderSharedHelper
Defined in:
app/helpers/washout_builder_method_list_helper.rb

Overview

helper that is used to list the method’s return tyep as a LI element in HTML documentation

Instance Method Summary collapse

Methods included from WashoutBuilderSharedHelper

#find_class_from_string, #find_correct_complex_type

Instance Method Details

#create_return_complex_type_list_html(xml, complex_class, builder_out) ⇒ String

this method will create the return type of the method and check if the type is basic or complex type or array of types

Parameters:

  • xml (Builder::XmlMarkup)

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

  • complex_class (Array)

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

  • builder_out (Array<WashOut::Param>)

    An array of params ( will contain a single position in the array) this is used to determine if the class is an array or not

Returns:

  • (String)


13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/washout_builder_method_list_helper.rb', line 13

def create_return_complex_type_list_html(xml, complex_class, builder_out)
  real_class = find_correct_complex_type(complex_class)
  return_content = builder_out[0].multiplied ?  "Array of #{real_class}" : "#{real_class}"
  xml.span('class' => 'pre') do
    xml.a('href' => "##{real_class}") do |inner_xml|
      inner_xml.span('class' => 'lightBlue') do |y|
        y << "#{return_content}"
      end
    end
  end
end

#create_return_type_list_html(xml, output) ⇒ String

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

Parameters:

  • xml (Builder::XmlMarkup)

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

  • output (Array<WashOut::Param>)

    t 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:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/helpers/washout_builder_method_list_helper.rb', line 36

def create_return_type_list_html(xml, output)
  if output.nil? || output[0].blank?
    xml.span('class' => 'pre') { |sp| sp << 'void' }
  else
    complex_class = output[0].find_complex_class_name
    if WashoutBuilder::Type::BASIC_TYPES.include?(output[0].type)
      xml.span('class' => 'pre') do |inner_xml|
        inner_xml.span('class' => 'blue') do |sp|
          sp << "#{output[0].type}"
        end
      end
    else
      create_return_complex_type_list_html(xml, complex_class, output) unless complex_class.nil?
    end
  end
end