Module: Bio::PDB::DataType::Pdb_String

Defined in:
lib/bio/db/pdb/pdb.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) [](nn)

Creates a new module with a string left justified to the length given in nn



99
100
101
102
103
104
105
106
107
108
# File 'lib/bio/db/pdb/pdb.rb', line 99

def self.[](nn)
  m = Module.new
  m.module_eval %Q{
    @@nn = nn
    def self.new(str)
      str.to_s.gsub(/\s+\z/, '').ljust(@@nn)[0, @@nn]
    end
  }
  m
end

+ (Object) new(str)



93
94
95
# File 'lib/bio/db/pdb/pdb.rb', line 93

def self.new(str)
  str.to_s.gsub(/\s+\z/, '')
end