| 1 | package DBIx::NoSQL::TypeMap; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Any::Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | has _map => qw/ is ro isa HashRef /, default => sub { {} }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 9 | |||||||||||
| 10 | sub BUILD { | ||||||||||
| 11 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 12 | |||||||||||
| 13 | $self->create( 'DateTime', | ||||||||||
| 14 | 0 | ▶ | inflate => sub { return DateTime->from_epoch( epoch => $_[0] ) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 15 | 0 | ▶ | deflate => sub { return $_[0]->epoch }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 16 | 0 | ); | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | sub type { | ||||||||||
| 20 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | 0 | my $name = shift; | |||||||||
| 22 | |||||||||||
| 23 | 0 | return $self->_map->{ $name }; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | #has _cache => qw/ is rw isa HashRef /, default => sub { {} }; | ||||||||||
| 27 | #sub find { | ||||||||||
| 28 | #my $self = shift; | ||||||||||
| 29 | #my $package = shift; | ||||||||||
| 30 | |||||||||||
| 31 | #my $type; | ||||||||||
| 32 | #my $cache = $self->_cache; | ||||||||||
| 33 | #while( ! $type ) { | ||||||||||
| 34 | #} | ||||||||||
| 35 | #} | ||||||||||
| 36 | |||||||||||
| 37 | sub create { | ||||||||||
| 38 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 39 | 0 | my $name = shift; | |||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | die "Already have type ($name)" if $self->_map->{ $name }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | 0 | my $type = $self->_map->{ $name } = DBIx::NoSQL::TypeMap::Type->new( name => $name, @_ ); | |||||||||
| 44 | 0 | return $type; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | package DBIx::NoSQL::TypeMap::Type; | ||||||||||
| 48 | |||||||||||
| 49 | 1 | ▶ | use Any::Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 50 | |||||||||||
| 51 | 1 | has name => qw/ is ro required 1 isa Str /; | |||||||||
| 52 | |||||||||||
| 53 | 1 | has inflate => qw/ accessor _inflate isa Maybe[CodeRef] /; | |||||||||
| 54 | 1 | has deflate => qw/ accessor _deflate isa Maybe[CodeRef] /; | |||||||||
| 55 | 0 | ▶ | sub inflator { return shift->_inflate( @_ ) } | ||||||||
|
Subroutine
inflator: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 56 | 0 | ▶ | sub deflator { return shift->_deflate( @_ ) } | ||||||||
|
Subroutine
deflator: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | sub inflate { return $_[0]->_inflate->( $_[1] ) } | ||||||||
|
Subroutine
inflate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 59 | 0 | ▶ | sub deflate { return $_[0]->_deflate->( $_[1] ) } | ||||||||
|
Subroutine
deflate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 60 | |||||||||||
| 61 | 1 | 1; | |||||||||