class Bio::Nexus::Util

DESCRIPTION

Bio::Nexus::Util is a class containing static helper methods

Public Class Methods

array_to_string( ary ) click to toggle source

Returns string as array separated by “ ”.


Arguments:

  • (required) ary: Array

Returns

String

     # File lib/bio/db/nexus.rb
1822 def Util::array_to_string( ary )
1823   str = String.new
1824   ary.each do | e |
1825     str << e << " "
1826   end
1827   str.chomp!( " " )
1828   str  
1829 end
larger_than_zero( i ) click to toggle source

Returns true if Integer i is not nil and larger than 0.


Arguments:

  • (required) i: Integer

Returns

true or false

     # File lib/bio/db/nexus.rb
1836 def Util::larger_than_zero( i )
1837   return ( i != nil && i.to_i > 0 )
1838 end
longer_than_zero( str ) click to toggle source

Returns true if String str is not nil and longer than 0.


Arguments:

  • (required) str: String

Returns

true or false

     # File lib/bio/db/nexus.rb
1845 def Util::longer_than_zero( str )
1846   return ( str != nil && str.length > 0 )
1847 end
to_nexus_helper( block, lines ) click to toggle source

Helper method to produce nexus formatted data.


Arguments:

  • (required) block: Nexus:GenericBlock or its subclasses

  • (required) block: Array

Returns

String

     # File lib/bio/db/nexus.rb
1805 def Util::to_nexus_helper( block, lines )
1806   str = String.new
1807   str << BEGIN_BLOCK << " " << block << END_OF_LINE
1808   lines.each do | line |
1809     if ( line != nil )
1810       str << INDENTENTION << line << END_OF_LINE
1811     end
1812   end # do
1813   str << END_BLOCK << END_OF_LINE
1814   str
1815 end