aboutsummaryrefslogtreecommitdiff
path: root/lib/WebCoso/Collections.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebCoso/Collections.pm')
-rw-r--r--lib/WebCoso/Collections.pm74
1 files changed, 0 insertions, 74 deletions
diff --git a/lib/WebCoso/Collections.pm b/lib/WebCoso/Collections.pm
deleted file mode 100644
index f0f9815..0000000
--- a/lib/WebCoso/Collections.pm
+++ /dev/null
@@ -1,74 +0,0 @@
-package WebCoso::Collections;
-use strict;
-use warnings;
-use Class::Std;
-use List::MoreUtils 'any';
-
-{
-my %collections_of :ATTR( :get<collections_ref> );
-
-sub BUILD {
- my ($self,$ident,$args_ref)=@_;
-
- $collections_of{$ident} = [];
-}
-
-sub add_collection {
- my ($self, $collection)=@_;
-
- return if any { $_ eq $collection } $self->get_all_collections();
-
- push @{ $self->get_collections_ref() }, $collection;
-}
-
-sub get_all_collections {
- my ($self)=@_;
- return @{ $self->get_collections_ref() };
-}
-
-sub get_root_collections {
- my ($self)=@_;
-
- return grep {
- $_->get_parents() == 0
- } $self->get_all_collections();
-}
-
-sub get_leaf_collections {
- my ($self)=@_;
-
- return grep {
- $_->get_children() == 0
- } $self->get_all_collections();
-}
-
-sub get_axes {
- return 'language';
-}
-
-sub get_axis_values {
- my ($self,$axis_name)=@_;
- if ($axis_name eq 'language') {
- return $self->_get_languages();
- }
- else {
- return;
- }
-}
-
-sub _get_languages {
- my ($self)=@_;
- my %langs=();
-
- for my $collection ($self->get_all_collections()) {
- @langs{ $collection->get_axis_values('language') } = ();
- }
-
- delete $langs{''};
-
- return keys %langs;
-}
-
-}
-
-1;