Commit 93df162a authored by Leo Gordon's avatar Leo Gordon
Browse files

concentrate the "Configurable" functionality in one class with the intention to use it wider

parent 8cc52d20
# A base class for objects that we want to be configurable in the following sense:
# 1) have a pointer to the $config
# 2) know their context
# 3) automatically apply that context when getting and setting
package Bio::EnsEMBL::Hive::Configurable;
use strict;
use warnings;
sub config {
my $self = shift @_;
if(@_) {
$self->{'_config'} = shift @_;
}
return $self->{'_config'};
}
sub context {
my $self = shift @_;
if(@_) {
$self->{'_context'} = shift @_;
}
return $self->{'_context'};
}
sub config_get {
my $self = shift @_;
return $self->config->get( @{$self->context}, @_ );
}
sub config_set {
my $self = shift @_;
return $self->config->set( @{$self->context}, @_ );
}
1;
......@@ -7,6 +7,8 @@ package Bio::EnsEMBL::Hive::Meadow;
use strict;
use warnings;
use base ('Bio::EnsEMBL::Hive::Configurable');
sub new {
my ($class, $config) = @_;
......@@ -14,6 +16,7 @@ sub new {
my $self = bless {}, $class;
$self->config( $config );
$self->context( [ 'Meadow', $self->type, $self->name ] );
return $self;
}
......@@ -35,30 +38,6 @@ sub signature {
}
sub config {
my $self = shift @_;
if(@_) {
$self->{'_config'} = shift @_;
}
return $self->{'_config'};
}
sub config_get {
my $self = shift @_;
return $self->config->get('Meadow', $self->type, $self->name, @_);
}
sub config_set {
my $self = shift @_;
return $self->config->set('Meadow', $self->type, $self->name, @_);
}
sub pipeline_name { # if set, provides a filter for job-related queries
my $self = shift @_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment