aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-07-06 19:26:53 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-07-06 19:26:53 +0100
commit71a7f74ebce81d4430397f702879edc86683f122 (patch)
tree5aab1f87753d3cb81ee9c7fc1255f910e9ccd2d5
parentb27d1e71a9be412f057c0ee873709ea4ca8964b0 (diff)
downloadpaludis-71a7f74ebce81d4430397f702879edc86683f122.tar.gz
paludis-71a7f74ebce81d4430397f702879edc86683f122.tar.xz
Wrap PackageID::uniquely_identifying_spec
-rw-r--r--ruby/package_id.cc23
-rw-r--r--ruby/package_id_TEST.rb4
2 files changed, 27 insertions, 0 deletions
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 94862cf..d661866 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -80,6 +80,28 @@ namespace
return Qnil;
}
+ /*
+ * call-seq:
+ * uniquely_identifying_spec -> PackageDepSpec
+ *
+ * Our name.
+ */
+ VALUE
+ package_id_uniquely_identifying_spec(VALUE self)
+ {
+ std::shared_ptr<const PackageID> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<const PackageID>, self_ptr);
+ try
+ {
+ return package_dep_spec_to_value((*self_ptr)->uniquely_identifying_spec());
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+
+ return Qnil;
+ }
/*
* call-seq:
@@ -535,6 +557,7 @@ namespace
&KeyValue<MetadataValueKey<SlotName>, &PackageID::slot_key>::fetch)), 0);
rb_define_method(c_package_id, "behaviours_key", RUBY_FUNC_CAST((
&KeyValue<MetadataCollectionKey<Set<std::string> >, &PackageID::behaviours_key>::fetch)), 0);
+ rb_define_method(c_package_id, "uniquely_identifying_spec", RUBY_FUNC_CAST(&package_id_uniquely_identifying_spec), 0);
/*
* Document-module: Paludis::PackageIDCanonicalForm
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 4466654..d287c24 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -198,6 +198,10 @@ module Paludis
b = pid_testrepo
assert a.eql?(b)
end
+
+ def test_uniquely_identifying_spec
+ assert_kind_of PackageDepSpec, pid_testrepo.uniquely_identifying_spec
+ end
end
class TestCase_ERepo < Test::Unit::TestCase