aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-05-06 20:51:28 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-05-12 11:33:35 +0100
commit57229d3c88a580548406b10198088698421f7967 (patch)
treeef3986438029cddae3f2f19ab1e5000048851ffd /ruby
parent984050842f2dd81d34cd2de19cf58709a5e90b15 (diff)
downloadpaludis-57229d3c88a580548406b10198088698421f7967.tar.gz
paludis-57229d3c88a580548406b10198088698421f7967.tar.xz
Add AtMostOneDepSpec
Diffstat (limited to 'ruby')
-rw-r--r--ruby/dep_spec.cc19
-rw-r--r--ruby/nice_names.nn1
2 files changed, 20 insertions, 0 deletions
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 91766cc18..32d07b023 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -59,6 +59,7 @@ namespace
static VALUE c_all_dep_spec;
static VALUE c_any_dep_spec;
static VALUE c_exactly_one_dep_spec;
+ static VALUE c_at_most_one;
static VALUE c_conditional_dep_spec;
static VALUE c_version_requirements_mode;
@@ -131,6 +132,7 @@ namespace
WrappedSpec<AllDepSpec>,
WrappedSpec<AnyDepSpec>,
WrappedSpec<ExactlyOneDepSpec>,
+ WrappedSpec<AtMostOneDepSpec>,
WrappedSpec<ConditionalDepSpec>
>::Type>
{
@@ -272,6 +274,12 @@ namespace
wrapped.reset((new WrappedSpec<ExactlyOneDepSpec>(std::static_pointer_cast<ExactlyOneDepSpec>(node.spec()->clone())))->add_children(node.begin(), node.end()));
klass = c_exactly_one_dep_spec;
}
+
+ void visit(const GenericSpecTree::NodeType<AtMostOneDepSpec>::Type & node)
+ {
+ wrapped.reset((new WrappedSpec<AtMostOneDepSpec>(std::static_pointer_cast<AtMostOneDepSpec>(node.spec()->clone())))->add_children(node.begin(), node.end()));
+ klass = c_at_most_one;
+ }
};
template <typename T_>
@@ -1017,6 +1025,17 @@ namespace
rb_define_method(c_exactly_one_dep_spec, "each", RUBY_FUNC_CAST((&Composite<AllDepSpec>::each)), 0);
/*
+ * Document-class: Paludis::AtMostOneDepSpec
+ *
+ * Represents a "?? ( )" dependency block. Includes
+ * Enumerable[http://www.ruby-doc.org/core/classes/Enumerable.html].
+ */
+ c_at_most_one = rb_define_class_under(paludis_module(), "AtMostOneDepSpec", c_dep_spec);
+ rb_funcall(c_at_most_one, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_include_module(c_at_most_one, rb_mEnumerable);
+ rb_define_method(c_at_most_one, "each", RUBY_FUNC_CAST((&Composite<AllDepSpec>::each)), 0);
+
+ /*
* Document-class: Paludis::ConditionalDepSpec
*
* Represents a use? ( ) dependency spec. Includes
diff --git a/ruby/nice_names.nn b/ruby/nice_names.nn
index c90f18f8a..60dab855a 100644
--- a/ruby/nice_names.nn
+++ b/ruby/nice_names.nn
@@ -24,6 +24,7 @@ make_nn_NiceNames() {
name "SimpleURIDepSpec"
name "AllDepSpec"
name "AnyDepSpec"
+ name "AtMostOneDepSpec"
name "ExactlyOneDepSpec"
name "ConditionalDepSpec"
name "BlockDepSpec"