[BioRuby-cvs] bioruby/lib bio.rb,1.89.2.2,1.89.2.3
Naohisa Goto
ngoto at dev.open-bio.org
Fri Feb 22 14:26:18 UTC 2008
Update of /home/repository/bioruby/bioruby/lib
In directory dev.open-bio.org:/tmp/cvs-serv30562
Modified Files:
Tag: BRANCH-biohackathon2008
bio.rb
Log Message:
reverted to 1.89
Index: bio.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v
retrieving revision 1.89.2.2
retrieving revision 1.89.2.3
diff -C2 -d -r1.89.2.2 -r1.89.2.3
*** bio.rb 20 Feb 2008 13:54:19 -0000 1.89.2.2
--- bio.rb 22 Feb 2008 14:26:16 -0000 1.89.2.3
***************
*** 278,310 ****
end
- class String
- def fold(width = 80)
- self.gsub(Regexp.new("(.{1,#{width}})"), "\\1\n").sub(/\n$/, '')
- end
-
- def wrap(width = 80, prefix = '')
- actual_width = width - prefix.length
- result = []
- left = self.dup
- while left and left.length > actual_width
- line = nil
- actual_width.downto(1) do |i|
- if left[i..i] == ' ' or /[,;]/ =~ left[(i-1)..(i-1)] then
- line = left[0..(i-1)].sub(/ +\z/, '')
- left = left[i..-1].sub(/\A +/, '')
- break
- end
- end
- if line.nil? then
- line = left[0..(actual_width-1)]
- left = left[actual_width..-1]
- end
- result << line
- end
- result << left if left
- result_string = result.join("\n#{prefix}")
- result_string = prefix + result_string unless result_string.empty?
- # result_string << "\n" unless result_string.empty?
- return result_string
- end
- end
--- 278,279 ----
More information about the bioruby-cvs
mailing list