Sha256: 8a90c6b4b1ca17496ab2ab7a5bcbc3a81ec8363ae1b9d8b3fff5a2dcb1dfe093

Contents?: true

Size: 1.87 KB

Versions: 10

Compression:

Stored size: 1.87 KB

Contents

# module that is used for constructing complex types in HTML-Documentation
module WashoutBuilderComplexTypeHelper
  # this method is for printing the attributes of a complex type
  # if the attributes are primitives this will show the attributes with  blue color
  # otherwise will call another method for printing the complex attribute
  # @see WashoutBuilder::Type::BASIC_TYPES
  # @see #create_complex_element_type_html
  #
  # @param [Array] pre Array that contains the content that will be appended to the xml element li
  # @param [WashOut::Param] element  the element that needs to be printed
  #
  # @return [void]
  #
  # @api public
  def create_element_type_html(pre, element)
    element.type = 'string' if element.type == 'text'
    element.type = 'integer' if element.type == 'int'
    if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
      pre << "<span class='blue'>#{element.type}</span>&nbsp;<span class='bold'>#{element.name}</span>"
    else
      create_complex_element_type_html(pre, element)
    end
  end

  # checks if a complex attribute of a complex type is a array or not
  # and retrieves the complex class name of the attribute and prints it
  # @see WashoutBuilder::Document::ComplexType#find_complex_class_name
  # @see WashOutParam#multiplied
  #
  # @param [Array] pre Array that contains the content that will be appended to the xml element li
  # @param [WashOut::Param] element  the element that needs to be printed
  #
  # @return [void]
  #
  # @api public
  def create_complex_element_type_html(pre, element)
    complex_class = element.find_complex_class_name
    return if complex_class.nil?
    complex_class_content = element.multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
    pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class_content}</span></a>&nbsp;<span class='bold'>#{element.name}</span>"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
washout_builder-1.0.5 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-1.0.4 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-1.0.2 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-1.0.0 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-0.16.5 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-0.16.4 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-0.16.3 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-0.16.2 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-0.16.1 app/helpers/washout_builder_complex_type_helper.rb
washout_builder-0.16.0 app/helpers/washout_builder_complex_type_helper.rb