Class: Chem::CDX::CDXCoordinate

Inherits:
Object
  • Object
show all
Defined in:
lib/chem/db/cdx.rb

Overview

def prop type, byte

    return [$cdx_name2value[type], byte.length].pack('ss') + byte
  end
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coord) ⇒ CDXCoordinate

Returns a new instance of CDXCoordinate.



552
553
554
# File 'lib/chem/db/cdx.rb', line 552

def initialize coord
  @coord = coord.to_f
end

Instance Attribute Details

#coordObject (readonly)

Returns the value of attribute coord.



550
551
552
# File 'lib/chem/db/cdx.rb', line 550

def coord
  @coord
end

Instance Method Details

#to_binObject



560
561
562
# File 'lib/chem/db/cdx.rb', line 560

def to_bin
  return [@coord].pack('l')
end

#to_xmlObject



556
557
558
# File 'lib/chem/db/cdx.rb', line 556

def to_xml
  "%.0f" % [@coord / 65536]
end