aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 22:03:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 22:03:40 +0000
commit57211c15f04a7fd382263319a154a555c757f09f (patch)
tree2e44e54591605475c0fdf061eceeae90d6a2c258 /ruby
parentf2476fe77fe49511a4c22544bf2cbccbc5cfd6cb (diff)
downloadpaludis-57211c15f04a7fd382263319a154a555c757f09f.tar.gz
paludis-57211c15f04a7fd382263319a154a555c757f09f.tar.xz
GenericSpecTree can contain ExactlyOneDepSpec
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 aacaf7069..155068358 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_conditional_dep_spec;
static VALUE c_version_requirements_mode;
@@ -130,6 +131,7 @@ namespace
WrappedSpec<NamedSetDepSpec>,
WrappedSpec<AllDepSpec>,
WrappedSpec<AnyDepSpec>,
+ WrappedSpec<ExactlyOneDepSpec>,
WrappedSpec<ConditionalDepSpec>
>::Type>
{
@@ -265,6 +267,12 @@ namespace
wrapped.reset((new WrappedSpec<AnyDepSpec>(std::static_pointer_cast<AnyDepSpec>(node.spec()->clone())))->add_children(node.begin(), node.end()));
klass = c_any_dep_spec;
}
+
+ void visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & node)
+ {
+ 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;
+ }
};
template <typename T_>
@@ -1123,6 +1131,17 @@ namespace
rb_define_method(c_any_dep_spec, "each", RUBY_FUNC_CAST((&Composite<AllDepSpec>::each)), 0);
/*
+ * Document-class: Paludis::ExactlyOneDepSpec
+ *
+ * Represents a "^^ ( )" dependency block. Includes
+ * Enumerable[http://www.ruby-doc.org/core/classes/Enumerable.html].
+ */
+ c_exactly_one_dep_spec = rb_define_class_under(paludis_module(), "ExactlyOneDepSpec", c_dep_spec);
+ rb_funcall(c_exactly_one_dep_spec, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_include_module(c_exactly_one_dep_spec, rb_mEnumerable);
+ rb_define_method(c_exactly_one_dep_spec, "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 d923538db..3752a259a 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 "ExactlyOneDepSpec"
name "ConditionalDepSpec"
name "BlockDepSpec"
name "StringDepSpec"