aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2008-01-19 15:02:45 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2008-01-19 15:02:45 +0000
commita4ca4d4cdd5111d9bd652599d6f9dbe959e199a4 (patch)
tree55a6c0175278a7f7252df4e4bcc59397b00e0b47
parentc7f2754f21ae21a41fc66ab9355ed0e8047f6c02 (diff)
downloadpaludis-a4ca4d4cdd5111d9bd652599d6f9dbe959e199a4.tar.gz
paludis-a4ca4d4cdd5111d9bd652599d6f9dbe959e199a4.tar.xz
(ruby) PackageID.name should return a QualifiedPackageName
-rw-r--r--ruby/package_id.cc25
-rw-r--r--ruby/package_id_TEST.rb10
2 files changed, 21 insertions, 14 deletions
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 98b3ad2..9ced9ad 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -53,6 +53,21 @@ namespace
/*
* call-seq:
+ * name -> QualifiedPackageName
+ *
+ * Our name.
+ */
+ VALUE
+ package_id_name(VALUE self)
+ {
+ tr1::shared_ptr<const PackageID> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<const PackageID>, self_ptr);
+ return qualified_package_name_to_value((*self_ptr)->name());
+ }
+
+
+ /*
+ * call-seq:
* supports_action(action_test) -> true or false
*
* Returns whether we support an action.
@@ -98,14 +113,6 @@ namespace
*
* Our slot
*/
- /*
- * Document-method: name
- *
- * call-seq:
- * name -> String
- *
- * Our name
- */
template <typename T_, typename S_, const T_ (S_::* m_) () const>
struct BaseValue
{
@@ -424,7 +431,7 @@ namespace
c_package_id = rb_define_class_under(paludis_module(), "PackageID", rb_cObject);
rb_funcall(c_package_id, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_package_id, "canonical_form", RUBY_FUNC_CAST(&package_id_canonical_form), 1);
- rb_define_method(c_package_id, "name", RUBY_FUNC_CAST((&BaseValue<QualifiedPackageName,PackageID,&PackageID::name>::fetch)), 0);
+ rb_define_method(c_package_id, "name", RUBY_FUNC_CAST(&package_id_name), 0);
rb_define_method(c_package_id, "version", RUBY_FUNC_CAST(&package_id_version), 0);
rb_define_method(c_package_id, "slot", RUBY_FUNC_CAST((&BaseValue<SlotName,PackageID,&PackageID::slot>::fetch)), 0);
rb_define_method(c_package_id, "repository_name", RUBY_FUNC_CAST(&package_id_repository_name), 0);
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 4c409b3..d921385 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -109,7 +109,7 @@ module Paludis
end
def test_members
- { :name => String, :version => VersionSpec, :slot => String, :repository_name => String,
+ { :name => QualifiedPackageName, :version => VersionSpec, :slot => String, :repository_name => String,
:keywords_key => MetadataKeywordNameSetKey, :iuse_key => MetadataIUseFlagSetKey,
:short_description_key => MetadataStringKey, :long_description_key => MetadataStringKey,
:contents_key => MetadataContentsKey, :installed_time_key => MetadataTimeKey,
@@ -188,8 +188,8 @@ module Paludis
class TestCase_ERepo < Test::Unit::TestCase
include TestStuff
def test_name
- assert_kind_of String, pid_testrepo.name
- assert_equal 'foo/bar', pid_testrepo.name
+ assert_kind_of QualifiedPackageName, pid_testrepo.name
+ assert_equal QualifiedPackageName.new('foo/bar'), pid_testrepo.name
end
def test_version
@@ -281,8 +281,8 @@ module Paludis
include TestStuff
def test_name
- assert_kind_of String, pid_installed.name
- assert_equal 'cat-one/pkg-one', pid_installed.name
+ assert_kind_of QualifiedPackageName, pid_installed.name
+ assert_equal QualifiedPackageName.new('cat-one/pkg-one'), pid_installed.name
end
def test_version