source: ruby/branches/0.0/models/rm/support/identification.rb@ 167

Last change on this file since 167 was 167, checked in by KOBAYASHI, Shinji, 15 years ago

adjust for rails

File size: 1.4 KB
RevLine 
[167]1module OpenEhr
[4]2 module RM
3 module Support
[26]4 module Identification
5
6 class OBJECT_ID
[4]7 attr_accessor :value
[26]8
[4]9 def initiallize(value)
[26]10 raise "empty value" unless value
[4]11 @value = value
12 end
13 end # of ObjectID
[26]14
15 class ARCHETYPE_ID < OBJECT_ID
16 end
17
18 class TERMINOLOGY_ID < OBJECT_ID
[4]19 attr_reader :name
[26]20
21 def initialize(name , version_id)
22 @name , @version_id = name , version_id
23# if arg1 == nil
24# super(arg0)
25# else
26# super(toValue(arg0, arg1))
27# @name = arg0
28# @version = arg1
29# end
[4]30 end
[26]31
[4]32 def setValue(value)
33 loadValue(value)
34 super.value = value
35 end
[26]36
[4]37 def version_id
38 @version
39 end
[26]40
[4]41 private
[26]42
[4]43 def loadValue(value)
44 if /\(.*\)$/ =~ value
[26]45# @name, @version = value.split(\())
[4]46 @version.chop!
47 else
48 @name = value
49 @version = nil
50 end
51 end
[26]52
[4]53 def toValue(name, version)
54 if name == ""
55 raise Exception.new("empty name")
56 end
57 name + (version == nil ? "" : "(" + version + ")")
58 end
59 end # of TerminologyID
60 end # of Definition
61 end # of Support
62 end # of RM
63end # of OpenEHR
Note: See TracBrowser for help on using the repository browser.