summary refs log tree commit diff
path: root/lib/presque/worker/Role
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-28 08:18:45 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-28 08:18:45 +0200
commit76c5d898ff9f46d14704284fa21f46373284b14f (patch)
tree7d408e9a521a6ce593246e0404dc043a2f7a0c1f /lib/presque/worker/Role
parentremove rest client; use net::presque from now (diff)
downloadpresque-worker-76c5d898ff9f46d14704284fa21f46373284b14f.tar.gz
context is the configuration
Diffstat (limited to 'lib/presque/worker/Role')
-rw-r--r--lib/presque/worker/Role/Context.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/presque/worker/Role/Context.pm b/lib/presque/worker/Role/Context.pm
new file mode 100644
index 0000000..5eccf7b
--- /dev/null
+++ b/lib/presque/worker/Role/Context.pm
@@ -0,0 +1,20 @@
+package presque::worker::Role::Context;
+
+use YAML;
+
+use Moose::Role;
+use Moose::Util::TypeConstraints;
+
+subtype 'Context' => as 'HashRef';
+
+coerce 'Context' => from 'Str' => via { Load $_; };
+
+has context => (
+    is      => 'rw',
+    isa     => 'Context',
+    lazy    => 1,
+    coerce  => 1,
+    default => {{}},
+);
+
+1;