source: ruby/branches/0.5/lib/open_ehr/rm/data_structures/representation.rb@ 186

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

refs #53

File size: 1.4 KB
Line 
1# rm::data_structures::representation
2# representation module
3# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109066789167_738055_2581Report.html
4# refs #53
5module OpenEhr
6 module RM
7 module DataStructures
8 module Representation
9 class Item < OpenEhr::RM::Common::Archetyped::Locatable
10 def initialize(args = {})
11 super(args)
12 end
13 end
14
15 class Element < Item
16 attr_accessor :value
17 attr_reader :null_flavor
18 def initialize(args = {})
19 super(args)
20 self.value = args[:value]
21 self.null_flavor= args[:null_flavor]
22 end
23
24 def null_flavor=(null_flavor)
25 sr = nil
26 if !null_flavor.nil? and
27 null_flavor.defining_code.terminology_id.name == 'openehr'
28 sr = Terminology.find(:first,
29 :conditions => "code = '#{null_flavor.defining_code.code_string}'")
30 end
31 if null_flavor.nil? or (!sr.nil? and sr.group == 'null flavours')
32 @null_flavor = null_flavor
33 else
34 raise ArgumentError, 'null_flavor is invalid'
35 end
36 end
37
38 def is_null?
39 return @value.nil?
40 end
41 end
42 end # of Representation
43 end # of DataStructures
44 end # of RM
45end # of OpenEhr
Note: See TracBrowser for help on using the repository browser.