summary refs log tree commit diff
path: root/lib/Net/Riak/Role/Base.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-14 17:53:00 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-14 17:54:23 +0200
commitce47f3bb5e8c69a59b678c8ff8956d8a368bcb32 (patch)
treee1542c99df3edd44e9434f244318ff2d871df633 /lib/Net/Riak/Role/Base.pm
parentis_alive moved to client (diff)
downloadnet-riak-ce47f3bb5e8c69a59b678c8ff8956d8a368bcb32.tar.gz
add mx::role::parameterized for replicas, bucket and client
Diffstat (limited to 'lib/Net/Riak/Role/Base.pm')
-rw-r--r--lib/Net/Riak/Role/Base.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Net/Riak/Role/Base.pm b/lib/Net/Riak/Role/Base.pm
new file mode 100644
index 0000000..fbeb9ba
--- /dev/null
+++ b/lib/Net/Riak/Role/Base.pm
@@ -0,0 +1,28 @@
+package Net::Riak::Role::Base;
+
+use MooseX::Role::Parameterized;
+
+parameter classes => (
+    isa      => 'ArrayRef',
+    required => 1,
+);
+
+role {
+    my $p = shift;
+
+    my $attributes = $p->classes;
+
+    foreach my $attr (@$attributes) {
+        my $name     = $attr->{name};
+        my $required = $attr->{required},
+          my $class  = "Net::Riak::" . (ucfirst $name);
+        has $name => (
+            is       => 'rw',
+            isa      => $class,
+            required => $required,
+        );
+    }
+};
+
+1;
+