Navigation Menu

Skip to content

Commit

Permalink
make plugins actual classes. Mixins aren't really meant for this purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
cjfields committed Nov 16, 2014
1 parent 9a2626d commit 56f6733
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 3 additions & 7 deletions lib/Bio/SeqIO.pm6
Expand Up @@ -7,6 +7,8 @@ class Bio::SeqIO does Bio::Role::Pluggable['SeqIO']
does Bio::Role::RecordFormat
{

has $!plugin handles <next-Seq write-Seq>;

submethod BUILD(:$!format,
:$!format-version?,
:$!format-variant?,
Expand All @@ -27,15 +29,9 @@ class Bio::SeqIO does Bio::Role::Pluggable['SeqIO']
if ::($plugin) ~~ Failure {
die "Can't load $plugin: $!";
} else {
# mix in the plugin module
self does ::($plugin);
$!plugin = ::($plugin).new(|%args);
}
self.initialize-io(|%args);
}

method next-Seq { ... }

method write-Seq { ... }

method guess-format { ... }
}
8 changes: 4 additions & 4 deletions lib/Bio/SeqIO/fasta.pm6
Expand Up @@ -14,16 +14,16 @@ class Bio::Grammar::Fasta::Actions::PrimarySeq {
}
}

role Bio::SeqIO::fasta does Bio::Role::SeqStream {
class Bio::SeqIO::fasta does Bio::Role::SeqStream {
has $.buffer is rw;
has $!actions = Bio::Grammar::Fasta::Actions::PrimarySeq.new();
has $.width = 60;
has $.block = $!width; # NYI

# Note multimethod signature
multi method initialize-io(:$width?, *%args) {
$!width = $width;
# Note multi method signature
multi method initialize-io(:$!width?, :$fh?, :$file?, *%args) {
nextsame;
#callwith(:nl("\n>"), :$fh, :$file, |%args);
}

# TODO: this is a temporary iterator to return one sequence record at a
Expand Down

0 comments on commit 56f6733

Please sign in to comment.