source: ruby/branches/0.5.0/lib/open_ehr/rm/data_types/basic.rb@ 167

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

adjust for rails

File size: 2.0 KB
Line 
1# This module is implemented from this UML:
2# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067591791_562382_3151Report.html
3# Ticket refs #52
4module OpenEhr
5 module RM
6 module DataTypes
7 module Basic
8 module CanonicalFragment
9 end
10
11 class DataValue
12 include OpenEhr::RM::Support::Definition::BasicDefinition
13 end
14
15 class DvBoolean < DataValue
16 def initialize(value)
17 self.value = value
18 end
19 def value=(value)
20 raise ArgumentError, "value must not be nil" if value.nil?
21 if value == true or value =~ /TRUE/i
22 @value = true
23 else
24 @value = false
25 end
26 end
27 def value?
28 @value == true
29 end
30 end # end of DvBoolean
31
32 class DvState < DataValue
33 attr_reader :value
34
35 def initialize(value, is_terminal)
36 self.value=value
37 self.is_terminal=is_terminal
38 end
39 def value=(v)
40 raise ArgumentError, "value should not be nil" if v.nil?
41 @value = v
42 end
43 def is_terminal?
44 @is_terminal
45 end
46 def is_terminal=(s)
47 raise ArgumentError, "terminal should not be nil" if s.nil?
48 @is_terminal = s
49 end
50 end # end of DvState
51
52 class DvIdentifier
53 attr_accessor :issuer, :assigner, :id, :type
54 def initialize(assigner, id, issuer, type)
55 if assigner.nil? or assigner.empty?\
56 or id.nil? or id.empty? or issuer.nil? or issuer.empty?\
57 or type.nil? or type.empty?
58 raise ArgumentError, "invalid argument"
59 end
60 @issuer = issuer
61 @assigner = assigner
62 @id = id
63 @type = type
64 end
65 end #end of DvIdentifier
66 end # end of Basic
67 end # end of DataTypes
68 end # end of RM
69end # end of OpenEHR
Note: See TracBrowser for help on using the repository browser.