source: ruby/branches/0.5.0/lib/open_ehr/rm/support/assumed_types.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 
1# Because his module utilise common methods in both rm
2# and am, I will integrated to /lib/models/assumed_types.rb.
3# By Shinji KOBAYASHI, 2008-07-20
4module OpenEhr
5 module RM
6 module Support
7 module AssumedTypes
8 class Interval
9 attr_accessor :lower, :upper
10# attr_accessor :lower_included, :lower_unbounded
11# attr_accessor :upper_included, :upper_unbounded
12 def initialize(lower, upper,
13 lower_included = nil, upper_included = nil)
14 if ((lower !=nil) && (upper !=nil)) && lower>upper
15 raise ArgumentError, "upper < lower"
16 end
17 @lower = lower
18 @upper = upper
19 end
20 end
21
22 class List
23 attr_reader :content
24
25 def initialize(arg)
26 @content = arg
27 end
28
29 def first
30 @content.first
31 end
32
33 def last
34 @content.last
35 end
36 end
37
38 class TIME_DEFINITIONS
39 end
40
41
42 class ISO8601_DATE < TIME_DEFINITIONS
43 end
44
45 class ISO8601_TIME < TIME_DEFINITIONS
46 end
47
48 class ISO8601_DURATION < TIME_DEFINITIONS
49 end
50
51 class ISO8601_DATE_TIME < TIME_DEFINITIONS
52 end
53
54 class ISO8601_TIMEZONE < TIME_DEFINITIONS
55 end
56
57 class String
58 attr_reader :content
59 def initialize(arg)
60 @content = arg
61 end
62
63 def as_integer
64 is_integer if is_integer
65 end
66
67 def is_empty
68 end
69
70 def is_integer
71 begin
72 Integer(@content)
73 rescue
74 false
75 end
76 end
77 end
78 end
79 end
80 end
81end
Note: See TracBrowser for help on using the repository browser.