source: ruby/branches/0.0/models/rm/data_types/time_specification.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.7 KB
Line 
1module OpenEhr
2 module RM
3 module DataTypes
4 module TimeSpecification
5 class DvTimeSpecification < OpenEhr::RM::DataTypes::Basic::DataValue
6 def initialize(value)
7 @value = value
8 end
9 def calender_alignment
10 raise NotImlementedError, "calender_alignment must be implemented"
11 end
12 def event_alignment
13 raise NotImlementedError, "event_alignment must be implemented"
14 end
15 def institution_specified
16 raise NotImlementedError, "institution_specified must be implemented"
17 end
18 end
19
20 class DvGeneralTimeSpecification < DvTimeSpecification
21 attr_reader :value
22 def initialize(value)
23 value_valid(value)
24 super(value)
25 end
26 def value=(value)
27 value_valid(value)
28 @value = value
29 end
30 private
31 def value_valid(value)
32 raise ArgumentError, "value is not valied" if !value.formalism.is_equal?('HL7:GTS')
33 end
34 end
35
36 class DvPeriodicTimeSpecification < DvTimeSpecification
37 attr_reader :value
38 def initialize(value)
39 value_valid(value)
40 super(value)
41 end
42 def calender_alignment
43 end
44 def event_alignment
45 end
46 def institution_specified?
47 end
48 def period
49 end
50 private
51 def value_valid(value)
52 if !value.formalism.is_equal('HL7:PIVL') && value.formalism.is_equal('HL7:EIVL')
53 raise ArgumentError, "value is not valid"
54 end
55 end
56 end
57 end
58 end # of Data_Type
59 end # of RM
60end # of OpenEHR
Note: See TracBrowser for help on using the repository browser.