Sets all internal variables from a hash
14263
def build!(options)
      # Massage JSON
      options.each { |key,value| options[key] = false if options[key] == "false" }

      @id              = options["id"]
      @owner           = options["owner"]
      @status          = options["status"]
      @error           = options["error"]
      @name            = options["name"]
      @browser         = options["browser"]
      @browser_version = options["browser_version"]
      @os              = options["os"]
      @creation_time   = options["creation_time"].to_i
      @start_time      = options["start_time"].to_i
      @end_time        = options["end_time"].to_i
      @video_url       = options["video_url"]
      @log_url         = options["log_url"]
      @public          = options["public"]
      @tags            = options["tags"]
      @passed          = options["passed"]
      @custom_data     = options['custom-data']

      raise NoIDError if @id.nil? or @id.empty?
    end
291645
def set_parameters(hash_or_instance)
      parameters = extract_parameters_from_hash_or_instance(hash_or_instance)
      parameters.each do |k,v|
        send "#{k}=", v
      end
    end
1342882
def deep_set_symbol_key(hash, key, value)
      if value.kind_of? Hash
        hash[key.to_sym] = value.inject({}) { |inner_hash, (inner_key, inner_value)| deep_set_symbol_key(inner_hash, inner_key, inner_value) }
      else
        hash[key.to_sym] = value
      end
      hash
    end
642516
def set(key, value)
      @memory[key] = value
      trim(key) if @memory[key].is_a? Array
    end
608861
def update(self, byts):
        '''
        
        '''
        self.size += len(byts)
        [h[1].update(byts) for h in self.hashes]
1170299
def to_h
      Hash[
        attribute_names.
        map do |name| [
          name.to_s.gsub("@","").to_sym,  # key
          (instance_variable_get(name) rescue send(name))] # val
        end
      ]
    end
1168899
def to_params_hash(keys,values)
      hash = {}
      keys.size.times { |i| hash[ keys[i].to_sym ] = values[i] }
      hash
    end
1314617
def to_hash
      config = { database: database, hosts: hosts }
      if username && password
        config.merge!(username: username, password: password)
      end
      config
    end
1309829
def string_keys(hash={})
      hash.inject({}) do |options, (key, value)|
        options[key.to_s] = value
        options
      end
    end
158762
def expr_hash
      vary = valued_parameters.map do |key, value|
        [ key, to_expr(key, value) ]
      end

      Hash[ vary ]
    end
215944
def to_hash(obj)
      return nil unless obj
      return obj if obj.is_a?(Hash)

      hash = {}
      obj.instance_variables.each do |key|
        hash[key[1..-1].to_sym] = deeply_to_hash(obj.instance_variable_get(key))
      end
      hash
    end
963768
def init_with_hash(hash)
      @tuple = Hash.new
      hash.each do |k, v|
        raise InvalidHashTupleKey unless String === k
        @tuple[k] = v
      end
    end
520228
def to_s
      hash = {}
      @hooks_map.each_pair do |hook_event, nested_hash|
        hash[hook_event] = {}
        nested_hash.each_pair do |name, callbacks|
          hash[hook_event][name] = callbacks
        end
      end
      hash.to_s
    end
43721
def set_variable(name, value)
      current_path = '/api/v1/variables'
      payload = { 'name' => name, 'value' => value }.to_json
      @conn.put(current_path, payload)
    end
1069209
def initialize_for_speed(hash)
      hash.each_pair do |k,v|
        key = key_as_sym(k)
        case v
          when Array
            value = v.map { |element| translate_value(element) }
            container.store(key, value)
          when Hash
            container.store(key, NestedResult.new(v))
          else
            container.store(key, v)
        end
      end
    end
767047
def to_h
      hash = {}
      [:bri, :hue, :sat].each do |attr|
        value = send(attr)
        hash[attr] = value if value
      end
      hash
    end
559302
function hashSet(hash, key, value) {
        hash[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
      }