Sha256: d8d0fe286a237a042ceafe367efe90f4086fbab67256fd873ad737d9f69ac37e
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module Java::OrgTmapiCore::DatatypeAware include RTM::DatatypeAware extend Superiseable superised # Changes the value (and if given, the datatype) of this Occurrence. # # The datatype must be a String or Locator. # # If value is a String, this methods sets the string value and # the datatype implicitly to xsd:string. # # If argument is a Locator, this method sets the IRI value and # the datatype implicitly to xsd:anyURI. # # If argument is a Float, this method sets the Float value and # the datatype implicitly to xsd:float. # # If argument is a Fixnum, this method sets Fixnum value and # the datatype implicitly to xsd:long. # # If argument is a Bignum, this method sets Bignum value and # the datatype implicitly to xsd:integer. # # :call-seq: # value = value # value = value, datatype # def value=(args) if args.is_a?(Array) raise("value=(value) or value=(value,datatype)") unless args.size == 2 datatype = topic_map.create_locator(args.last) value = args.first.to_s if datatype.reference == RTM::PSI[:IRI] setValue(topic_map.create_locator(value)) else setValue(value, datatype) end else setValue(args) end end # Sets the datatype of this occurrence without changing its value. # # The datatype must be a String or Locator. # # :call-seq: # datatype = datatype # def datatype=(datatype) self.value = self.value, datatype end alias :set_datatype :datatype= end
Version data entries
3 entries across 3 versions & 1 rubygems