aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-28 22:19:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-01 03:57:52 +0000
commit92f0a95d1854442e744f707eaae9add7fd92ff67 (patch)
tree9d403328a07f89c1598b4d3cb0079b292d82729e /ruby
parent092228a814cd6700b97112b5dcf931c80b6b9431 (diff)
downloadpaludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.gz
paludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.xz
Pass env, id to ConditionalDepSpec members
Diffstat (limited to 'ruby')
-rw-r--r--ruby/dep_spec.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 530003009..e3ec5512c 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -555,25 +555,27 @@ namespace
/*
* Document-method: condition_met?
* call-seq:
- * condition_met? -> true or false
+ * condition_met?(Environment, PackageID) -> true or false
*
* Whether our condition is met.
*/
/*
* Document-method: condition_meetable?
* call-seq:
- * condition_meetable? -> true or false
+ * condition_meetable?(Environment, PackageID) -> true or false
*
* Whether our condition is meetable.
*/
- template <bool (ConditionalDepSpec::* f_) () const>
+ template <bool (ConditionalDepSpec::* f_) (const Environment * const, const std::shared_ptr<const PackageID> &) const>
struct ConditionalDepSpecBoolFunc
{
- static VALUE func(VALUE self)
+ static VALUE func(VALUE self, VALUE env, VALUE id)
{
std::shared_ptr<WrappedSpecBase> * p;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, p);
- return ((*std::static_pointer_cast<const WrappedSpec<ConditionalDepSpec> >(*p)->spec().get()).*f_)() ? Qtrue : Qfalse;
+ std::shared_ptr<Environment> e(value_to_environment(env));
+ std::shared_ptr<const PackageID> i(value_to_package_id(id));
+ return ((*std::static_pointer_cast<const WrappedSpec<ConditionalDepSpec> >(*p)->spec().get()).*f_)(e.get(), i) ? Qtrue : Qfalse;
}
};
@@ -1071,9 +1073,9 @@ namespace
rb_define_method(c_conditional_dep_spec, "condition", RUBY_FUNC_CAST(conditional_dep_spec_to_s), 0);
rb_define_alias(c_conditional_dep_spec, "to_s", "condition");
rb_define_method(c_conditional_dep_spec, "condition_met?", RUBY_FUNC_CAST(
- &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_met>::func), 0);
+ &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_met>::func), 2);
rb_define_method(c_conditional_dep_spec, "condition_meetable?", RUBY_FUNC_CAST(
- &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_meetable>::func), 0);
+ &ConditionalDepSpecBoolFunc<&ConditionalDepSpec::condition_meetable>::func), 2);
rb_define_method(c_conditional_dep_spec, "each", RUBY_FUNC_CAST((&Composite<AllDepSpec>::each)), 0);
/*