Last change
on this file since 4 was 4, checked in by KOBAYASHI, Shinji, 16 years ago |
restructuring repository tree
|
File size:
1.3 KB
|
Rev | Line | |
---|
[4] | 1 | module OpenEHR
|
---|
| 2 | module RM
|
---|
| 3 | module Support
|
---|
| 4 | module Definition
|
---|
| 5 | class Object_ID
|
---|
| 6 | attr_accessor :value
|
---|
| 7 | def initiallize(value)
|
---|
| 8 | if value == nil
|
---|
| 9 | raise Exception.new("empty value")
|
---|
| 10 | end
|
---|
| 11 | @value = value
|
---|
| 12 | end
|
---|
| 13 | end # of ObjectID
|
---|
| 14 | class Terminology_ID < Object_ID
|
---|
| 15 | attr_reader :name
|
---|
| 16 | def initialize(arg0, arg1=nil)
|
---|
| 17 | if arg1 == nil
|
---|
| 18 | super(arg0)
|
---|
| 19 | else
|
---|
| 20 | super(toValue(arg0, arg1))
|
---|
| 21 | @name = arg0
|
---|
| 22 | @version = arg1
|
---|
| 23 | end
|
---|
| 24 | end
|
---|
| 25 | def setValue(value)
|
---|
| 26 | loadValue(value)
|
---|
| 27 | super.value = value
|
---|
| 28 | end
|
---|
| 29 | def version_id
|
---|
| 30 | @version
|
---|
| 31 | end
|
---|
| 32 | private
|
---|
| 33 | def loadValue(value)
|
---|
| 34 | if /\(.*\)$/ =~ value
|
---|
| 35 | @name, @version = value.split(\())
|
---|
| 36 | @version.chop!
|
---|
| 37 | else
|
---|
| 38 | @name = value
|
---|
| 39 | @version = nil
|
---|
| 40 | end
|
---|
| 41 | end
|
---|
| 42 | def toValue(name, version)
|
---|
| 43 | if name == ""
|
---|
| 44 | raise Exception.new("empty name")
|
---|
| 45 | end
|
---|
| 46 | name + (version == nil ? "" : "(" + version + ")")
|
---|
| 47 | end
|
---|
| 48 | end # of TerminologyID
|
---|
| 49 | end # of Definition
|
---|
| 50 | end # of Support
|
---|
| 51 | end # of RM
|
---|
| 52 | end # of OpenEHR
|
---|
Note:
See
TracBrowser
for help on using the repository browser.