aboutsummaryrefslogtreecommitdiff
path: root/ruby/repository.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/repository.cc')
-rw-r--r--ruby/repository.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 63f18839a..e31825fe1 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -851,6 +851,27 @@ namespace
}
}
+ /*
+ * call-seq:
+ * each_metadata {|key| block } -> Nil
+ *
+ * Our metadata.
+ */
+ VALUE
+ repository_each_metadata(VALUE self)
+ {
+ tr1::shared_ptr<Repository> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<Repository>, self_ptr);
+ for (Repository::MetadataConstIterator it((*self_ptr)->begin_metadata()),
+ it_end((*self_ptr)->end_metadata()); it_end != it; ++it)
+ {
+ VALUE val(metadata_key_to_value(*it));
+ if (Qnil != val)
+ rb_yield(val);
+ }
+ return Qnil;
+ }
+
void do_register_repository()
{
/*
@@ -907,6 +928,8 @@ namespace
rb_define_method(c_repository, "check_qa", RUBY_FUNC_CAST(&repository_check_qa),5);
+ rb_define_method(c_repository, "each_metadata", RUBY_FUNC_CAST(&repository_each_metadata), 0);
+
/*
* Document-class: Paludis::ProfilesDescLine
*