aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Moral <victor@venexma.es>2014-01-29 10:17:26 +0100
committerVíctor Moral <victor@venexma.es>2014-01-29 10:17:26 +0100
commit44257747eeaa90db0f82cf6754b262f5493cdea9 (patch)
tree4c1f2d0357256407cc2359ca277c192a2782c303
parentd12528ae835d52620b1d59264c05473953f94e0b (diff)
downloadcdt-44257747eeaa90db0f82cf6754b262f5493cdea9.tar.gz
cdt-44257747eeaa90db0f82cf6754b262f5493cdea9.tar.bz2
cdt-44257747eeaa90db0f82cf6754b262f5493cdea9.zip
- Añadida clase base para elementos de una caja
- Añadida clase para crear enumeraciones - Nueva clase para elementos textuales
-rw-r--r--lib/CDT/Item/Base.pm65
-rw-r--r--lib/CDT/Item/Text.pm44
-rw-r--r--lib/CDT/Types.pm24
3 files changed, 133 insertions, 0 deletions
diff --git a/lib/CDT/Item/Base.pm b/lib/CDT/Item/Base.pm
new file mode 100644
index 0000000..3837443
--- /dev/null
+++ b/lib/CDT/Item/Base.pm
@@ -0,0 +1,65 @@
+package CDT::Item::Base;
+use Moose;
+use Moose::Util::TypeConstraints;
+use namespace::autoclean;
+use utf8;
+
+# extensions and roles
+use CDT::Types;
+
+# external modules
+use DateTime;
+
+# attributes
+has 'title' => (
+ documentation => q(Título),
+ is => 'ro',
+ isa => 'Str',
+);
+
+has 'author' => (
+ documentation => q(Quién lo ha enviado),
+ is => 'ro',
+ isa => 'Str',
+);
+
+has 'created' => (
+ documentation => q(Fecha de creación del elemento),
+ is => 'ro',
+ isa => 'DateTime',
+);
+
+has 'received' => (
+ documentation => q(Fecha de recepción del elemento),
+ is => 'ro',
+ isa => 'DateTime',
+);
+
+has 'tags' => (
+ documentation => q(Etiquetado del elemento),
+ traits => [ 'Array' ],
+ is => 'ro',
+ isa => 'ArrayRef[Str]',
+ default => sub { []; },
+);
+
+has 'type' => (
+ documentation => q(Tipo de contenido),
+ is => 'ro',
+ isa => 'CDT::Types::Items',
+);
+
+# variables
+our $VERSION = '0.1';
+
+# public methods
+
+# private methods
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+
+
diff --git a/lib/CDT/Item/Text.pm b/lib/CDT/Item/Text.pm
new file mode 100644
index 0000000..32abc6d
--- /dev/null
+++ b/lib/CDT/Item/Text.pm
@@ -0,0 +1,44 @@
+package CDT::Item::Text;
+use Moose;
+use Moose::Util::TypeConstraints;
+use namespace::autoclean;
+use utf8;
+
+# extensions and roles
+extends 'CDT::Item::Base';
+
+# external modules
+
+# attributes
+has '+type' => (
+ default => 'text',
+);
+
+has 'content' => (
+ documentation => q(Texto contenido),
+ is => 'ro',
+ isa => 'Maybe[Str]',
+ writer => 'set_content',
+);
+
+has 'format' => (
+ documentation => q(Formato del texto),
+ is => 'ro',
+ isa => 'CDT::Types::Text',
+ default => 'plain',
+);
+
+# variables
+our $VERSION = '0.1';
+
+# public methods
+
+# private methods
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+
+
diff --git a/lib/CDT/Types.pm b/lib/CDT/Types.pm
new file mode 100644
index 0000000..89c8f69
--- /dev/null
+++ b/lib/CDT/Types.pm
@@ -0,0 +1,24 @@
+package CDT::Types;
+use Moose;
+use Moose::Util::TypeConstraints;
+use namespace::autoclean;
+use utf8;
+
+# custom types
+enum 'CDT::Types::Items' => [qw(text image audio video html url cdt)];
+enum 'CDT::Types::Text' => [qw(plain html markdown)];
+
+# variables
+our $VERSION = '0.1';
+
+# public methods
+
+# private methods
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+
+