Permalink
Browse files

Create a class instead of using @values but @values[0]

  • Loading branch information...
1 parent e255d7e commit da4c71818c300c46a6f564cedc448bb8a03daebf @retupmoca retupmoca committed Feb 14, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/Email/Simple/Header.pm6
@@ -64,6 +64,10 @@ method as-string {
}
method Str { self.as-string }
+class HeaderResponse is Array {
+ method Str { self[0] }
+}
+
method header-names {
my @names = gather {
for @!headers {
@@ -87,7 +91,7 @@ method header (Str $name) {
}
}
- return @values but @values[0];
+ return HeaderResponse.new(@values);
}
method header-set ($field, *@values) {
@@ -118,7 +122,7 @@ method header-set ($field, *@values) {
@!headers[@indices[$_]] = [$field, @values[$_]];
}
- return @values but @values[0];
+ return HeaderResponse.new(@values);
}
method crlf {

0 comments on commit da4c718

Please sign in to comment.