aboutsummaryrefslogtreecommitdiff
path: root/ruby/repository.cc
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-12-15 23:17:25 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-12-15 23:17:25 +0000
commit693622cedcfea20d3775efe7e2ddf9b541c0af9f (patch)
tree0187d93b6662f975843e435fb8f29672ca9144e0 /ruby/repository.cc
parente0eecd0b51d1835a9cdfd37cb7a8d2fb8d196c79 (diff)
downloadpaludis-693622cedcfea20d3775efe7e2ddf9b541c0af9f.tar.gz
paludis-693622cedcfea20d3775efe7e2ddf9b541c0af9f.tar.xz
Partial commit
Diffstat (limited to 'ruby/repository.cc')
-rw-r--r--ruby/repository.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index e31825fe1..f1a0fa0a3 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -872,6 +872,18 @@ namespace
return Qnil;
}
+ template <typename T_, const tr1::shared_ptr<const T_> (Repository::* m_) () const>
+ struct RepositoryKey
+ {
+ static VALUE
+ fetch(VALUE self)
+ {
+ tr1::shared_ptr<Repository> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<Repository>, self_ptr);
+ return metadata_key_to_value(((**self_ptr).*m_)());
+ }
+ };
+
void do_register_repository()
{
/*
@@ -929,6 +941,10 @@ 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);
+ rb_define_method(c_repository, "format_key",
+ RUBY_FUNC_CAST((&RepositoryKey<MetadataStringKey, &Repository::format_key>::fetch)), 0);
+ rb_define_method(c_repository, "installed_root_key",
+ RUBY_FUNC_CAST((&RepositoryKey<MetadataFSEntryKey, &Repository::installed_root_key>::fetch)), 0);
/*
* Document-class: Paludis::ProfilesDescLine