summary refs log tree commit diff
path: root/lib/presque/worker
diff options
context:
space:
mode:
Diffstat (limited to 'lib/presque/worker')
-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;