lib/runcible/extensions/consumer_group.rb
def generate_content(type_id, units, options = {})
        content = []

        case type_id
        when 'rpm', 'package_group'
          unit_key = :name
        when 'erratum'
          unit_key = :id
        else
          unit_key = :id
        end

        if options[:all]
          content_unit = {}
          content_unit[:type_id] = type_id
          content_unit[:unit_key] = {}
          content.push(content_unit)
        else
          units.each do |unit|
            content_unit = {}
            content_unit[:type_id] = type_id
            content_unit[:unit_key] = { unit_key => unit }
            content.push(content_unit)
          end
        end
        content
      end
# Generate the content units used by other functions
#
# @param  [String]  type_id the type of content (e.g. rpm, errata)
# @param  [Array]   units   array of units
# @param  [Hash]    options contains options which may impact the format of the content (e.g :all => true)
# @return [Array]           array of formatted content units
Generate the content units used by other functions
Generate the content units used by other functions
def generate_content(type_id, units, options = {})
        content = []
        case type_id
        when 'rpm', 'package_group'
          unit_key = :name
        when 'erratum'
          unit_key = :id
        else
          unit_key = :id
        end
        if options[:all]
          content_unit = {}
          content_unit[:type_id] = type_id
          content_unit[:unit_key] = {}
          content.push(content_unit)
        else
          units.each do |unit|
            content_unit = {}
            content_unit[:type_id] = type_id
            content_unit[:unit_key] = { unit_key => unit }
            content.push(content_unit)
          end
        end
        content
      end
def generate_content ( type_id , units , options = { } ) content = [ ] case type_id when 'rpm' , 'package_group' unit_key = :name when 'erratum' unit_key = :id else unit_key = :id end if options [ :all ] content_unit = { } content_unit [ :type_id ] = type_id content_unit [ :unit_key ] = { } content . push ( content_unit ) else units . each do | unit | content_unit = { } content_unit [ :type_id ] = type_id content_unit [ :unit_key ] = { unit_key => unit } content . push ( content_unit ) end end content end
Generate the content units used by other functions
Generate the content units used by other functions
array of formatted content units
array of formatted content units
Array
type_id
units
options
options contains options which may impact the format of the content
options contains options which may impact the format of the content