Mercurial > pub > Impl
diff Lib/IMPL/Transform.pm @ 43:009aa9ca2e48
merge
author | Sergey |
---|---|
date | Thu, 07 Jan 2010 15:41:49 +0300 |
parents | d660fb38b7cc |
children | 32d2350fccf9 |
line wrap: on
line diff
--- a/Lib/IMPL/Transform.pm Thu Jan 07 15:34:42 2010 +0300 +++ b/Lib/IMPL/Transform.pm Thu Jan 07 15:41:49 2010 +0300 @@ -20,29 +20,35 @@ } sub Transform { - my ($this,$object) = @_; + my ($this,$object,@args) = @_; if (not ref $object) { die new IMPL::Exception("There is no the template for a plain value in the transform") unless $this->{$Plain}; my $template = $this->{$Plain}; - return $this->$template($object); + return $this->$template($object,@args); } else { my $template = $this->MatchTemplate($object) || $this->Default or die new IMPL::Transform::NoTransformException(ref $object); - return $this->$template($object); + return $this->$template($object,@args); } } sub MatchTemplate { my ($this,$object) = @_; - my $class = ref $object; + my $class = $this->GetClassForObject( $object ); foreach my $tClass ( keys %{$this->Templates || {}} ) { return $this->Templates->{$tClass} if ($tClass eq $class); } } +sub GetClassForObject { + my ($this,$object) = @_; + + return ref $object; +} + package IMPL::Transform::NoTransformException; use base qw(IMPL::Exception); @@ -76,7 +82,8 @@ my $result = $t->Transform($obj); -=head1 Summary -Преобразует данные содержащиеся в форме в реальные объекты используя специальное преобразование. +=head1 DESCRIPTION + +Преобразование одного объекта к другому, например даных к их представлению. =cut \ No newline at end of file