Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactor .gist to more closely match the spec.
  • Loading branch information
pmichaud committed Jul 7, 2011
1 parent 7d4d042 commit 15ec618
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/core/Iterator.pm
Expand Up @@ -6,5 +6,4 @@ my class Iterator {
method list() { (self,).list }
method flat() { (self,).flat }

method gist(Iterator:D:) { self.perl }
}
1 change: 1 addition & 0 deletions src/core/List.pm
Expand Up @@ -188,6 +188,7 @@ class List does Positional {
self[$index];
}

multi method gist(List:D:) { self.Str }
multi method perl(List:D \$self:) {
self.gimme(*);
self.Parcel.perl ~ '.list'
Expand Down
2 changes: 1 addition & 1 deletion src/core/Mu.pm
Expand Up @@ -103,7 +103,7 @@ my class Mu {

proto method gist(|$) { * }
multi method gist(Mu:U:) { self.HOW.name(self) ~ '()' }
multi method gist(Mu:D:) { self.Stringy }
multi method gist(Mu:D:) { self.perl }

proto method perl(|$) { * }
multi method perl(Mu:D:) { self.Str }
Expand Down
2 changes: 2 additions & 0 deletions src/core/Numeric.pm
Expand Up @@ -15,6 +15,8 @@ my class Numeric {
self.exp * $base.log;
}
multi method Bool(Numeric:D:) { self != 0 }

multi method gist(Numeric:D:) { self.Str }
}


Expand Down
1 change: 0 additions & 1 deletion src/core/Range.pm
Expand Up @@ -109,7 +109,6 @@ class Range is Iterable does Positional {

method at_pos($pos) { self.flat.at_pos($pos) }

multi method gist(Range:D:) { self.perl }
multi method perl(Range:D:) {
$.min.perl
~ ('^' if $.excludes_min)
Expand Down
1 change: 1 addition & 0 deletions src/core/Str.pm
Expand Up @@ -123,6 +123,7 @@ my class Str does Stringy {
"\b" => '\b', "\n" => '\n', "\r" => '\r', "\t" => '\t', '"' => '\"',
'\\' => '\\\\' );

multi method gist(Str:D:) { self }
multi method perl(Str:D:) {
my $result = '"';
for ^self.chars -> $i {
Expand Down

0 comments on commit 15ec618

Please sign in to comment.