From 1776bd778db4f6ed72eed47602877ab7a8fb904f Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 29 Aug 2011 13:54:58 +0100 Subject: reflectors, in box, and some refactor --- lib/Enigmatic/Reflector.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/Enigmatic/Reflector.pm (limited to 'lib/Enigmatic/Reflector.pm') diff --git a/lib/Enigmatic/Reflector.pm b/lib/Enigmatic/Reflector.pm new file mode 100644 index 0000000..b9371dd --- /dev/null +++ b/lib/Enigmatic/Reflector.pm @@ -0,0 +1,21 @@ +package Enigmatic::Reflector; +use DAKKAR::p 'class'; +use Enigmatic::Types qw(ReflWiringMap Letter); + +has wiring => ( + is => 'ro', + isa => ReflWiringMap, + coerce => 1, +); + +with 'Enigmatic::Role::WithWiring'; + +sub map { + my $self = shift; + my ($letter) = pos_validated_list( + \@_, + { isa => Letter }, + ); + + return $self->wiring->at($letter); +} -- cgit v1.2.3