[BioRuby] New Bio::Sequence and Handlers
Raoul Jean Pierre Bonnal
raoul.bonnal at itb.cnr.it
Mon Mar 3 15:17:50 UTC 2008
Hello Guys,
my solution to generalize Bio::Sequence for lazy loading or not,
discussed at Hackathon. Actually I don't know if this is the best
solution but works and keeps compatibility with current release.
rename Bio::Sequence --> Bio::SequenceScratch
then define a new class reusing namespace Bio::Sequence:
module Bio
class Sequence
#Handler for the generic sequence
attr_accessor :handler
#Class Sequence initializer, actually not well coded.
def initialize(obj)
if obj.is_a?(String)
@handler= Bio::SequenceScratch.new(obj)
else
@handler=obj
end
end
# Pass any unknown method calls to the wrapped sequence object. see
#
http://www.rubycentral.com/book/ref_c_object.html#Object.method_missing
def method_missing(sym, *args, &block) #:nodoc:
@handler.__send__(sym, *args, &block)
end
end
end
--
Ra
More information about the BioRuby
mailing list