summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-12-31 15:13:52 -0600
committerJesse Luehrs <doy@tozt.net>2012-12-31 15:13:52 -0600
commitf282ce1beea5f2c2be601c74818ea04e9df58de8 (patch)
treee023a946aba56ff3cb82227ecad7b6d84956391b
parent1f2284c23d96be5eb4b30a08b738f25448652d56 (diff)
downloadp6-bread-board-f282ce1beea5f2c2be601c74818ea04e9df58de8.tar.gz
p6-bread-board-f282ce1beea5f2c2be601c74818ea04e9df58de8.zip
a bit of cleanup
-rw-r--r--lib/Bread/Board.pm36
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/Bread/Board.pm b/lib/Bread/Board.pm
index 89f000b..e5f3757 100644
--- a/lib/Bread/Board.pm
+++ b/lib/Bread/Board.pm
@@ -141,7 +141,8 @@ role HasParameters {
die "Unknown parameter $name given";
}
if not %params{$name}.isa($.parameters{$name}<isa>) {
- die "{%params{$name}.perl} is not a valid value for the $name parameter";
+ die "{%params{$name}.perl} is not a valid value "
+ ~ "for the $name parameter";
}
}
@@ -188,6 +189,17 @@ class Dependency does Traversable {
}
}
+class Parameters {
+ has Hash $.params;
+ # XXX do we really want to keep this API? or should this really just be
+ # the service object?
+ has $.class;
+
+ method param (Str $name) {
+ return $.params{$name};
+ }
+}
+
class ConstructorInjection does Service does HasParameters does HasDependencies does HasClass {
has Str $.constructor_name is rw = 'new';
@@ -229,17 +241,6 @@ class ConstructorInjection does Service does HasParameters does HasDependencies
}
}
-class Parameters {
- has Hash $.params;
- # XXX do we really want to keep this API? or should this really just be
- # the service object?
- has $.class;
-
- method param (Str $name) {
- return $.params{$name};
- }
-}
-
class BlockInjection does Service does HasParameters does HasDependencies does HasClass {
has Callable $.block;
@@ -305,10 +306,14 @@ class Container does Traversable {
# PERL6: type coercions NYI
method new (*%params is copy) {
if %params<sub_containers>.isa(Array) {
- %params<sub_containers> = %params<sub_containers>.map(-> $c { $c.name => $c }).hash;
+ %params<sub_containers> = %params<sub_containers>.map(
+ -> $c { $c.name => $c }
+ ).hash;
}
if %params<services>.isa(Array) {
- %params<services> = %params<services>.map(-> $c { $c.name => $c }).hash;
+ %params<services> = %params<services>.map(
+ -> $c { $c.name => $c }
+ ).hash;
}
my $container = callwith(|%params);
if %params<sub_containers>:exists {
@@ -370,7 +375,8 @@ class Container does Traversable {
$str ~= "$spaces {$s.name // '???'}\n";
if ($s ~~ HasDependencies) {
for $s.dependencies.kv -> $dep_name, $dep {
- $str ~= "$spaces $dep_name\: {$dep.service_path // '???'}\n";
+ $str ~= "$spaces $dep_name\: "
+ ~ "{$dep.service_path // '???'}\n";
}
}
if ($s ~~ HasParameters) {