Parse the movies out of a hash.

 @param [Hash] hash The has to convert into an array of movies.

 @return [Array<BadFruit::Movie>] An array of BadFruit::Movie objects.
551677
def parse_movies_array(hash)
      moviesArray = Array.new
       hash["movies"].each do |movie|
          moviesArray.push(Movie.new(movie, self))
        end
        return moviesArray
    end
174329
def build_from_hash(attributes)
      return nil unless attributes.is_a?(Hash)
      self.class.swagger_types.each_pair do |key, type|
        if type =~ /^Array<(.*)>/i
          if attributes[self.class.attribute_map[key]].is_a?(Array)
            self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
          else
            #TODO show warning in debug mode
          end
        elsif !attributes[self.class.attribute_map[key]].nil?
          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
        else
          # data not found in attributes(hash), not an issue as the data can be optional
        end
      end

      self
    end
578721
def to_hash
      result = @response[:magic_response][:magic_result][:diffgram]
      result = strip_attributes(result)
      result = convert_dates_to_utc(result)

      if result.nil?
        return []
      end

      # All magic responses wrap their result in an ActionResponse element
      result = result.values.first

      # Often the first element in ActionResponse is an element
      # called ActionInfo, but in some cases it has a different name
      # so we just get the first element.
      result.values.first
    end
1160904
def loss_count_hash
      @loss_count_hash ||= matches.each_with_object(Hash.new(0)) { |match, hash| hash[get_match_loser(match)] += 1 }
    end
1238404
def convert_nils_to_empty_hashes(hash)
      hash.each_with_object({}) do |(key, value), h|
        h[key] =
          case value
          when nil  then {}
          when Hash then convert_nils_to_empty_hashes(value)
          else
            value
          end
      end
    end
1038149
def flatten(hash)
        hash.each_with_object({}) do |(key, value), h|
          if value.instance_of?(Hash)
            value.map do |k, v|
              # We could add recursion here if we ever had more than 2 levels
              h["#{key}.#{k}"] = v
            end
          else
            h[key] = value
          end
        end
      end
1112109
def properties
      hash = {}
      Parser::PROPERTIES.each do |property|
        hash[property] = __send__(property)
      end
      hash
    end
105214
function parseUrlHash_(hash) {
    const parameters = hash.split('&');

    let tabHash = parameters[0];
    if (tabHash === '' || tabHash === '#') {
      tabHash = undefined;
    }

    // Split each string except the first around the '='.
    let paramDict = null;
    for (let i = 1; i < parameters.length; i++) {
      const paramStrings = parameters[i].split('=');
      if (paramStrings.length !== 2) {
        continue;
      }
      if (paramDict === null) {
        paramDict = {};
      }
      const key = decodeURIComponent(paramStrings[0]);
      const value = decodeURIComponent(paramStrings[1]);
      paramDict[key] = value;
    }

    return {tabHash, parameters: paramDict};
  }
842277
def sym_hash_JSON(str)
      return nil if str.nil?
      case str
        when String
          raise ArgumentError.new('Can not parse an empty JSON string') if str.empty?
          to_sym_hash(JSON.parse(str))
        when Array, Hash
          to_sym_hash(str)
        else
          str
      end
    end
1333684
def deserialize_object(definition, hash)
      return nil if hash.nil?
      result = definition.new
      result.__fields.each do |field|
        name = field.key_json || name_to_json(field.sym)

        if field.options[:as] == :list
          value = deserialize_list(hash[name], field)
        elsif field.options[:as] == :dto
          value = deserialize_object(field.options[:of], hash[name])
        else
          value = hash[name]
        end

        next if value.nil?

        result.send("#{field.key_ruby}=", value)
      end
      result
    end
92828
def reviews
      data = JSON.parse(@badfruit.get_movie_info(@id, "reviews"))
      reviews = Array.new
      data["reviews"].each do |review|
        reviews.push(Review.new(review))
      end
       return reviews 
    end
1166627
def create_hash(response)
      begin
        JSON.parse response
      rescue JSON::ParserError
        response
      rescue StandardError
        response
      end
    end
231312
function argHashToArray(hash)
{
	var keys = Object.keys(hash);
	var result = [];
	for (var i = 0; i < keys.length; i++)
	{
		result[parseInt(keys[i], 10)] = hash[keys[i]];
	}
	return result;
}
917554
def init_many(hash)
    # generate single_parser
    pattern_element = PatternElement.new(hash[:many], @init_options.merge(name:hash[:as]))

    # generate delimiter_pattern_element
    many_delimiter_pattern_element = hash[:delimiter] && PatternElement.new(hash[:delimiter], @init_options.merge(name:hash[:delimiter_name]))

    # generate many-parser
    self.parser = lambda do |parent_node|
      parent_node.match_name_is_poly(pattern_element.name)

      # fail unless we can match at least one
      return unless parent_node.match pattern_element

      if many_delimiter_pattern_element
        parent_node.match_name_is_poly(many_delimiter_pattern_element.name)
        # delimited matching
        while (parent_node.attempt_match do
            parent_node.match_delimiter &&
            parent_node.match(many_delimiter_pattern_element).tap{|md|md&&md.many_delimiter=true} &&
            parent_node.match_delimiter &&
            parent_node.match(pattern_element)
          end)
        end
      else
        # not delimited matching
        while (parent_node.attempt_match do
            parent_node.match_delimiter &&
            parent_node.match(pattern_element)
          end)
        end
      end
      parent_node
    end
  end
1207086
def to_hash
      pairs = instance_variables.map do |var|
        [var.to_s.delete('@'), instance_variable_get(var)]
      end
      Hash[pairs]
    end
958391
def ParseFileHash(hash_obj, result):
    """"""
    if hash_obj.HasField("md5"):
      result.hash_md5 = str(hash_obj.md5)

    if hash_obj.HasField("sha1"):
      result.hash_sha1 = str(hash_obj.sha1)

    if hash_obj.HasField("sha256"):
      result.hash_sha256 = str(hash_obj.sha256)

    if hash_obj.HasField("pecoff_md5"):
      result.pecoff_hash_md5 = str(hash_obj.pecoff_md5)

    if hash_obj.HasField("pecoff_sha1"):
      result.pecoff_hash_sha1 = str(hash_obj.pecoff_sha1)

    if hash_obj.HasField("signed_data"):
      StatEntryToExportedFileConverter.ParseSignedData(hash_obj.signed_data[0],
                                                       result)
930245
def flatten_hash hash
      hash.flat_map do |key, value|
        case value
        when Hash
          value.map do |inner_key, inner_value|
            "#{key}[#{inner_key}]=#{inner_value}"
          end
        when Array
          value.map { |inner_value| "#{key}[]=#{inner_value}" }
        else
          "#{key}=#{value}"
        end
      end
    end