[BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.25,1.26
Naohisa Goto
ngoto at dev.open-bio.org
Fri Dec 28 14:31:08 UTC 2007
Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb
In directory dev.open-bio.org:/tmp/cvs-serv400/lib/bio/db/pdb
Modified Files:
pdb.rb
Log Message:
Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and
Bio::PDB::Record.create_definition_hash (Note: they should only
be internally used by PDB parser and users should not call them)
are changed to follow the change of Module#constants which
returns an array of Symbol instead of String.
Index: pdb.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** pdb.rb 28 Dec 2007 13:35:30 -0000 1.25
--- pdb.rb 28 Dec 2007 14:31:06 -0000 1.26
***************
*** 438,442 ****
hash = {}
constants.each do |x|
! hash[x] = const_get(x) if /\A[A-Z][A-Z0-9]+\z/ =~ x
end
if x = const_get(:Default) then
--- 438,443 ----
hash = {}
constants.each do |x|
! x = x.intern # keep compatibility both Ruby 1.8 and 1.9
! hash[x] = const_get(x) if /\A[A-Z][A-Z0-9]+\z/ =~ x.to_s
end
if x = const_get(:Default) then
***************
*** 1381,1385 ****
def_rec([ 2, 1, Pdb_Integer, :serial ]) # dummy field (always 0)
! Definition['END'] = End
# Basically just look up the class in Definition hash
--- 1382,1386 ----
def_rec([ 2, 1, Pdb_Integer, :serial ]) # dummy field (always 0)
! Definition['END'.intern] = End
# Basically just look up the class in Definition hash
***************
*** 1387,1397 ****
def self.get_record_class(str)
t = fetch_record_name(str)
if d = Definition[t] then
return d
end
case t
! when 'JRNL'
d = Jrnl::Definition[str[12..15].to_s.strip]
! when 'REMARK'
case str[7..9].to_i
when 1
--- 1388,1399 ----
def self.get_record_class(str)
t = fetch_record_name(str)
+ t = t.intern unless t.empty?
if d = Definition[t] then
return d
end
case t
! when :JRNL
d = Jrnl::Definition[str[12..15].to_s.strip]
! when :REMARK
case str[7..9].to_i
when 1
***************
*** 1418,1428 ****
--- 1420,1438 ----
Coordinate_fileds = {
'MODEL' => true,
+ :MODEL => true,
'ENDMDL' => true,
+ :ENDMDL => true,
'ATOM' => true,
+ :ATOM => true,
'HETATM' => true,
+ :HETATM => true,
'SIGATM' => true,
+ :SIGATM => true,
'SIGUIJ' => true,
+ :SIGUIJ => true,
'ANISOU' => true,
+ :ANISOU => true,
'TER' => true,
+ :TER => true,
}
More information about the bioruby-cvs
mailing list