aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 94862cfc3..d661866a6 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 44666544f..d287c2435 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