Parse the category data from any incoming API data

 @return [void] description_of_returned_object
519988
def parse_category
      cat =
        if self.class::CATEGORY_SUBSET == :top
          @init_data[:category]
        else
          @init_data[self.class::CATEGORY_SUBSET][:category]
        end

      if cat.is_a? String
        @category_name = cat
        @category_id = JSS::Category.category_id_from_name @category_name
      else
        @category_name = cat[:name]
        @category_id = cat[:id]
      end
      clean_raw_categories
    end
454713
def parse_response(response)
      case response.content_type
      when JSON_CONTENT_TYPE
        JSON.parse(response.body, quirks_mode: true, symbolize_names: true)
      else
        response.body
      end
    end
150286
def decode(data)
      return nil if data.nil? || data.strip.empty?
      decode_object(@load.call(data))
    end
216859
def parse_query(str)
      query = Hash.new
      if str
        str.split(/[&;]/).each{|x|
          next if x.empty?
          key, val = x.split(/=/,2)
          key = unescape_form(key)
          val = unescape_form(val.to_s)
          val = FormData.new(val)
          val.name = key
          if query.has_key?(key)
            query[key].append_data(val)
            next
          end
          query[key] = val
        }
      end
      query
    end
816703
def _parse_nested(self, name, results):
        
        progress = []

        for segment in name.split('.'):
            progress.append(segment)

            last = '.'.join(progress)
            if last not in results:
                results[last] = self.__class__(self.get_query().new_query())

        return results
146936
def parse(data = nil)
      data ||= @raw_data
    
      # wrapper array holding hashes of css tags/rules
      css_out = []
      # clear initial spaces
      data.strip_side_space!.strip_space!
    
      # split on end of assignments
      data.split('}').each_with_index do |assignments, index|
        # split again to separate tags from rules
        tags, styles = assignments.split('{').map{|a| a.strip_side_space!}
        unless styles.blank?
          # clean up tags and apply namespaces as needed
          tags.strip_selector_space!
          tags.gsub!(/\./, ".#{namespace}") unless namespace.blank?
      
          # split on semicolon to iterate through each rule
          rules = []
          styles.split(';').each do |key_val_pair|
            unless key_val_pair.nil?
              # split by property/val and append to rules array with correct declaration
              property, value = key_val_pair.split(':', 2).map{|kv| kv.strip_side_space!}
              break unless property && value
              rules << "#{property}:#{value};"
            end
          end
          # now keeps track of index as hashes don't keep track of position (which will be fixed in Ruby 1.9)
          css_out << {:tags => tags, :rules => rules.join, :idx => index} unless tags.blank? || rules.to_s.blank?
        end
      end
      css_out
    end
1107943
def obtain_category(check = nil)
      segments = []
      if check.blank?
        return nil if  params[:slug].blank?
        segments = params[:slug].split('/')
      end

      # get the taxonomy name and search the database for the record with this as its slug
      t = obtain_term_check(check, segments, 'category')
      t if !t.blank?
    end
826876
function extractCategoryMap(oSentence) {
    var res = {};
    debuglog(debuglog.enabled ? ('extractCategoryMap ' + JSON.stringify(oSentence)) : '-');
    oSentence.forEach(function (oWord, iIndex) {
        if (oWord.category === IFMatch.CAT_CATEGORY) {
            res[oWord.matchedString] = res[oWord.matchedString] || [];
            res[oWord.matchedString].push({ pos: iIndex });
        }
    });
    utils.deepFreeze(res);
    return res;
}
1157673
function _parse(type, obj, options)
{
    if (!obj) return _checkResult(type, lib.newError("empty " + type), obj, options);
    try {
        obj = _parseResult(type, obj, options);
    } catch(err) {
        obj = _checkResult(type, err, obj, options);
    }
    return obj;
}
336254
function parse(data) {
  try {
    return JSON.parse(data);
  } catch (e) {
    log('Oops! Some problems parsing this ' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + '.', 'error', debug);
  }

  return null;
}
772939
def json_data
      begin
        return JSON.parse(self.data)
      rescue JSON::ParserError, TypeError => e
        logger.warn "Error while parsing raw transaction data: #{e.message}"
        return {}
      end
    end
656685
function parse(data){
			var out = {source: 'api'};
        	if(data.ok && data.ok === true){

        		var entry = data.user;

        		if(entry.username){ out.nickname = entry.username };
        		if(entry.name){ out.fn = entry.name };
				if(entry.short_bio){ out.note = [entry.short_bio] };

        		if(entry.web_url){ 
        			if(!out.url) {out.url = []};
        			out.url.push(entry.web_url);
        		};

        		if(entry.twitter_url){ 
        			if(!out.url) {out.url = []};
        			out.url.push(entry.twitter_url);
        		};

				if(entry.avatar_url){ 
				  	var large = entry.avatar_url.replace('s48','s300');
					out.photo = [large] 
				};

			}
			return {type: ['h-card'], properties: out};
		}
672641
def parse_response(object)
      LOG.debug("response is #{object}")
      case object
        when ::Net::HTTPUnauthorized
          ::File.delete(ACCESS_TOKEN)
          raise 'user revoked oauth connection'
        when ::Net::HTTPOK then
          object.body
      end
    end
1088719
def gifs_categories_get(api_key, opts = {})
      data, _status_code, _headers = gifs_categories_get_with_http_info(api_key, opts)
      return data
    end
1363187
def get_context_data(self, **kwargs):
        
        context = super(BaseCategoryDetail, self).get_context_data(**kwargs)
        context['category'] = self.category
        return context
502581
def data_object(data)
      data = data.keys.first if data.is_a?(Hash) && data.keys.size == 1
      data = @_object.__send__(data) if data.is_a?(Symbol) && defined?(@_object) && @_object && @_object.respond_to?(data)
      data
    end
1054098
def parse(data)
      return unless data
      data.each do |line|
        key, value = line.split(':', 2)
        if key =~ /^FRU.*/
          if value =~ /([\w\s]*)\(.*\)/
            self[:name] = $~[1].strip.gsub(/\ /, '_').downcase
          end
        else
          key = key.strip.gsub(/\ /, '_').downcase.gsub(/fru_/, '')
          self[key] = value.strip unless value.nil?
        end
      end
    end