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, line 1822
def Util::array_to_string( ary )
  str = String.new
  ary.each do | e |
    str << e << " "
  end
  str.chomp!( " " )
  str  
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, line 1836
def Util::larger_than_zero( i )
  return ( i != nil && i.to_i > 0 )
end
longer_than_zero( str ) click to toggle source

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


Arguments:

Returns

true or false

# File lib/bio/db/nexus.rb, line 1845
def Util::longer_than_zero( str )
  return ( str != nil && str.length > 0 )
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, line 1805
def Util::to_nexus_helper( block, lines )
  str = String.new
  str << BEGIN_BLOCK << " " << block << END_OF_LINE
  lines.each do | line |
    if ( line != nil )
      str << INDENTENTION << line << END_OF_LINE
    end
  end # do
  str << END_BLOCK << END_OF_LINE
  str
end