Module: WashoutBuilderMethodArgumentsHelper
- Includes:
- WashoutBuilderSharedHelper
- Defined in:
- app/helpers/washout_builder_method_arguments_helper.rb
Overview
helper that is used to show the arguments of a method with their types in HTML documentation
Instance Method Summary collapse
-
#create_argument_element_spacer(xml, j, mlen) ⇒ String
this method will check if the current index of the argument is not last, will insert a comma then a break if the argument is followed by other arguments, and if the current index is equal to the size of argyments, will display a ‘)’ sign.
-
#create_html_public_method_arguments(xml, pre, input) ⇒ String
this method will go through each of the arguments print them and then check if we need a spacer after it.
-
#create_method_argument_complex_element(pre, param, use_spacer, spacer, complex_class) ⇒ void
displayes an argument of a method as complex type and determines if is an array of types or not.
-
#create_method_argument_element(pre, param, mlen) ⇒ void
displays the parameter of a method as argument and determines if the parameter is basic type or complex type.
Methods included from WashoutBuilderSharedHelper
#find_class_from_string, #find_correct_complex_type
Instance Method Details
#create_argument_element_spacer(xml, j, mlen) ⇒ String
this method will check if the current index of the argument is not last, will insert a comma then a break if the argument is followed by other arguments, and if the current index is equal to the size of argyments, will display a ‘)’ sign
56 57 58 59 60 61 62 63 64 65 |
# File 'app/helpers/washout_builder_method_arguments_helper.rb', line 56 def create_argument_element_spacer(xml, j, mlen) if j < (mlen - 1) xml.span ', ' end if mlen > 1 xml.br end return unless (j + 1) == mlen xml.span('class' => 'bold') { |y| y << ')' } end |
#create_html_public_method_arguments(xml, pre, input) ⇒ String
this method will go through each of the arguments print them and then check if we need a spacer after it
@see #create_method_argument_element
@see #create_argument_element_spacer
79 80 81 82 83 84 85 86 87 |
# File 'app/helpers/washout_builder_method_arguments_helper.rb', line 79 def create_html_public_method_arguments(xml, pre, input) mlen = input.size xml.br if mlen > 1 return unless mlen > 0 input.each_with_index do |element, index| create_method_argument_element(pre, element, mlen) create_argument_element_spacer(xml, index, mlen) end end |
#create_method_argument_complex_element(pre, param, use_spacer, spacer, complex_class) ⇒ void
This method returns an undefined value.
displayes an argument of a method as complex type and determines if is an array of types or not
39 40 41 42 43 44 |
# File 'app/helpers/washout_builder_method_arguments_helper.rb', line 39 def create_method_argument_complex_element(pre, param, use_spacer, spacer, complex_class) return if complex_class.nil? real_class = find_correct_complex_type(complex_class) argument_content = param.multiplied ? "Array of #{real_class}" : "#{real_class}" pre << "#{use_spacer ? spacer : ''}<a href='##{real_class}'><span class='lightBlue'>#{argument_content}</span></a> <span class='bold'>#{param.name}</span>" end |
#create_method_argument_element(pre, param, mlen) ⇒ void
This method returns an undefined value.
displays the parameter of a method as argument and determines if the parameter is basic type or complex type
17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/washout_builder_method_arguments_helper.rb', line 17 def create_method_argument_element(pre, param, mlen) spacer = ' ' complex_class = param.find_complex_class_name use_spacer = mlen > 1 ? true : false if WashoutBuilder::Type::BASIC_TYPES.include?(param.type) pre << "#{use_spacer ? spacer : ''}<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>" else create_method_argument_complex_element(pre, param, use_spacer, spacer, complex_class) end end |