Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storage role splitted into storage and storage_class
Signed-off-by: Pedro Melo <melo@simplicidade.org>
- Loading branch information
Showing
2 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
package Config::Connie::Storage; | ||
|
||
use Moo::Role; | ||
use Carp (); | ||
use namespace::autoclean; | ||
|
||
requires 'build_storage'; | ||
has 'storage' => (is => 'lazy', builder => 'build_storage', handles => ['check_for_updates']); | ||
has 'storage_class' => (is => 'lazy', builder => 'build_storage_class'); | ||
|
||
sub build_storage { | ||
my ($self) = @_; | ||
|
||
return $self->storage_class->new(instance => $self); | ||
} | ||
|
||
sub build_storage_class { Carp::confess "Class '" . ref(shift) . "' requires a build_storage_class method" } | ||
|
||
has 'storage' => (is => 'ro', builder => 'build_storage', handles => ['check_for_updates']); | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters