Class: Chem::CDX::CDXCoordinate
- Inherits:
-
Object
- Object
- Chem::CDX::CDXCoordinate
- 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
-
#coord ⇒ Object
readonly
Returns the value of attribute coord.
Instance Method Summary collapse
-
#initialize(coord) ⇒ CDXCoordinate
constructor
A new instance of CDXCoordinate.
- #to_bin ⇒ Object
- #to_xml ⇒ Object
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
#coord ⇒ Object (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_bin ⇒ Object
560 561 562 |
# File 'lib/chem/db/cdx.rb', line 560 def to_bin return [@coord].pack('l') end |
#to_xml ⇒ Object
556 557 558 |
# File 'lib/chem/db/cdx.rb', line 556 def to_xml "%.0f" % [@coord / 65536] end |