aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-11-13 21:06:32 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-11-13 21:06:32 +0000
commit95105e0c87bf58803d559738a3fe201b457a0af1 (patch)
treed5aa079393bb682b61806e83c399734f0673bdec
parent3fbf2ecd6835960ff0497ce952ee5f0b7f08acb0 (diff)
downloadpaludis-95105e0c87bf58803d559738a3fe201b457a0af1.tar.gz
paludis-95105e0c87bf58803d559738a3fe201b457a0af1.tar.xz
(ruby) Add Repository::some_ids_might_support_action.
-rw-r--r--ruby/repository.cc17
-rwxr-xr-x[-rw-r--r--]ruby/repository_TEST.rb11
2 files changed, 28 insertions, 0 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index eff7c94..898ed25 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -422,6 +422,21 @@ namespace
/*
* call-seq:
+ * some_ids_might_support_action(action_test) -> true or false
+ *
+ * Might some of our IDs support a particular action?
+ */
+ VALUE
+ repository_some_ids_might_support_action(VALUE self, VALUE test)
+ {
+ tr1::shared_ptr<Repository> * self_ptr;
+ tr1::shared_ptr<const SupportsActionTestBase> test_ptr(value_to_supports_action_test_base(test));
+ Data_Get_Struct(self, tr1::shared_ptr<Repository>, self_ptr);
+ return (*self_ptr)->some_ids_might_support_action(*test_ptr) ? Qtrue : Qfalse;
+ }
+
+ /*
+ * call-seq:
* info(verbose) -> RepositoryInfo
*
* Fetch our RepositoryInfo
@@ -989,6 +1004,8 @@ namespace
rb_define_method(c_repository, "qa_interface", RUBY_FUNC_CAST((&Interface<RepositoryQAInterface,
&Repository::qa_interface>::fetch)), 0);
+ rb_define_method(c_repository, "some_ids_might_support_action", RUBY_FUNC_CAST(&repository_some_ids_might_support_action), 1);
+
rb_define_method(c_repository, "info", RUBY_FUNC_CAST(&repository_info), 1);
rb_define_method(c_repository, "query_use", RUBY_FUNC_CAST((&QueryUse<UseFlagState, use_enabled, use_disabled, &RepositoryUseInterface::query_use>::query)), -1);
rb_define_method(c_repository, "query_use_mask", RUBY_FUNC_CAST((&QueryUse<bool, true, false, &RepositoryUseInterface::query_use_mask>::query)), -1);
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index 3c03190..3401cf3 100644..100755
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -502,6 +502,17 @@ module Paludis
end
end
+ class TestCase_RepositorySomeIdsMightSupport < Test::Unit::TestCase
+ include RepositoryTestCase
+
+ def test_some_ids_might_support
+ assert repo.some_ids_might_support_action(SupportsInstallActionTest.new)
+ assert ! repo.some_ids_might_support_action(SupportsInstalledActionTest.new)
+ assert ! installed_repo.some_ids_might_support_action(SupportsInstallActionTest.new)
+ assert installed_repo.some_ids_might_support_action(SupportsInstalledActionTest.new)
+ end
+ end
+
class TestCase_FakeRepository < Test::Unit::TestCase
include RepositoryTestCase