source: ruby/branches/0.0/models/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: 1.8 KB
RevLine 
[167]1module OpenEhr
[4]2 module RM
[167]3 module DataTypes
[4]4 module Basic
[167]5 module CanonicalFragment
[4]6 end
7
[167]8 class DataValue
9 include OpenEhr::RM::Support::Definition::BasicDefinition
[4]10 end
11
[167]12 class DvBoolean < DataValue
[4]13 def initialize(value)
14 check_not_nil(value)
15 if value == "TRUE" or value == true
16 @value = true
17 else
18 @value = false
19 end
20 end
21 def value=(value)
22 check_not_nil(value)
23 @value = value
24 end
25 def value?
26 @value == true
27 end
28 private
29 def check_not_nil(value)
30 if value == nil
31 raise ArgumentError, "value must not be empty"
32 end
33 end
[167]34 end # end of DvBoolean
[4]35
[167]36 class DvState < DataValue
[4]37 attr_accessor :value
38 attr_writer :terminal
39 def initialize(value, terminal)
40 if value == nil or terminal == nil
41 raise ArgumentError, "argument mandatory"
42 end
43 @value = value
44 @terminal = terminal
45 end
46 def is_terminal?
47 @terminal == true
48 end
[167]49 end # end of DvState
[4]50
[167]51 class DvIdentifier
[4]52 attr_accessor :issuer, :assigner, :id, :type
53 def initialize(assigner, id, issuer, type)
54 if assigner == nil or id == nil or issuer == nil or type == nil
55 raise ArgumentError, "invalid argument"
56 end
57 @issuer = issuer
58 @assigner = assigner
59 @id = id
60 @type = type
61 end
[167]62 end #end of DvIdentifier
[4]63 end # end of Basic
64 end # end of Data_types
65 end # end of RM
66end # end of OpenEHR
Note: See TracBrowser for help on using the repository browser.