+static int
+merge_cb (VALUE key, VALUE value, VALUE self)
+{
+ c_aset (self, key, value);
+
+ return ST_CONTINUE;
+}
+
+/*
+ * call-seq:
+ * object.merge!(hash) -> object
+ *
+ * Adds the key-value pairs from *hash* to *object*, overwriting existing
+ * values if a key already existed in *object*.
+ */
+static VALUE
+c_merge (VALUE self, VALUE hash)
+{
+ Check_Type (hash, T_HASH);
+
+ rb_hash_foreach (hash, merge_cb, self);
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * object.shift(hash) -> array or nil
+ *
+ * Removes the first key-value pair from *object* and returns it
+ * as the two-item array [key, value].
+ * If *object* is empty, +nil+ is returned.
+ */
+static VALUE
+c_shift (VALUE self)
+{
+ return rb_ary_shift (rb_iv_get (self, "items"));
+}
+