Class: Chem::CDX::CDXBoolean

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

Instance Method Summary collapse

Constructor Details

#initialize(tf) ⇒ CDXBoolean

Returns a new instance of CDXBoolean.



601
602
603
# File 'lib/chem/db/cdx.rb', line 601

def initialize tf
  @bool = tf
end

Instance Method Details

#to_binObject



609
610
611
612
613
614
615
616
# File 'lib/chem/db/cdx.rb', line 609

def to_bin
  if @bool
    str = [1].pack('c')
  else
    str = [0].pack('c')
  end
  str
end

#to_xmlObject



605
606
607
# File 'lib/chem/db/cdx.rb', line 605

def to_xml
  @bool ? "yes" : "no"
end