Sha256: 0b9d85e1c94d2c3fd25c6c19de48fcce30dbdcc2589f49a2b76f6a3e69518a70
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module CV class Param attr_accessor :cv_ref, :accession, :name, :value # A valueless CV::Param object that describes the units being used attr_accessor :unit def initialize(cv_ref, accession, name, value=nil) (@cv_ref, @accession, @name, @value) = [cv_ref, accession, name, value] end # for now, assumes this is a Nokogiri::XML::Builder object def to_xml(xml, name=:cvParam) hash_to_send = {:cvRef => @cvref, :accession => @accession, :name => @name} hash_to_send[:value] = @value if @value if unit hash_to_send.merge!( { :unitCvRef => unit.cv_ref, :unitAccession => unit.accession, :unitName => unit.name } ) end xml.send(name, hash_to_send) end def ==(other) if !other.nil? && other.is_a?(CV::Param) [:cv_ref, :accession, :name, :value, :unit].inject(true) do |bool, mthd| bool && (self.send(mthd) == other.send(mthd)) end else ; false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mspire-0.6.7 | lib/cv/param.rb |