Skip to content

Commit

Permalink
Rearrangement of require and autoload so as to correctly load PhyloXM…
Browse files Browse the repository at this point in the history
…L classes
  • Loading branch information
ngoto committed Oct 23, 2009
1 parent b018370 commit 3137ea9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
16 changes: 15 additions & 1 deletion lib/bio/db/phyloxml/phyloxml_elements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@
#
# * https://www.nescent.org/wg_phyloinformatics/PhyloSoC:PhyloXML_support_in_BioRuby

require 'bio/tree'
require 'bio/sequence'
require 'bio/reference'

# Autoload definition
module Bio
module PhyloXML
autoload :Parser, 'bio/db/phyloxml/phyloxml_parser'
autoload :Writer, 'bio/db/phyloxml/phyloxml_writer'
end
end

require 'libxml'

module Bio

# This is general Taxonomy class.
Expand Down Expand Up @@ -1157,4 +1171,4 @@ def to_xml

end #module PhyloXML

end #end module Bio
end #end module Bio
11 changes: 6 additions & 5 deletions lib/bio/db/phyloxml/phyloxml_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
# * https://www.nescent.org/wg_phyloinformatics/PhyloSoC:PhyloXML_support_in_BioRuby


module Bio

module PhyloXML
require 'uri'
require 'libxml'

require 'bio/tree'

require 'bio/db/phyloxml/phyloxml_elements'

require 'libxml'

module Bio

module PhyloXML



Expand Down
5 changes: 4 additions & 1 deletion lib/bio/db/phyloxml/phyloxml_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#
# * https://www.nescent.org/wg_phyloinformatics/PhyloSoC:PhyloXML_support_in_BioRuby

require 'libxml'
require 'bio/db/phyloxml/phyloxml_elements'

module Bio

module PhyloXML
Expand Down Expand Up @@ -222,4 +225,4 @@ def node_to_xml(tree, node, parent)
end

end
end
end
5 changes: 0 additions & 5 deletions test/unit/bio/db/test_phyloxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)

require 'bio/sequence'
require 'bio/tree'

begin
require 'libxml'
rescue LoadError
end

if defined?(LibXML) then
require 'bio/db/phyloxml/phyloxml_elements'
require 'bio/db/phyloxml/phyloxml_parser'
require 'bio/db/phyloxml/phyloxml_writer'
end

module Bio
Expand Down
3 changes: 0 additions & 3 deletions test/unit/bio/db/test_phyloxml_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)

require 'bio/tree'
require 'bio/command'

begin
Expand All @@ -24,8 +23,6 @@
end

if defined?(LibXML) then
require 'bio/db/phyloxml/phyloxml_elements'
require 'bio/db/phyloxml/phyloxml_parser'
require 'bio/db/phyloxml/phyloxml_writer'
end

Expand Down

0 comments on commit 3137ea9

Please sign in to comment.