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

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

refs #53 correct directory

File size: 1.5 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 ItemStructure
9 module Representation
10 class Item < OpenEhr::RM::Common::Archetyped::Locatable
11 def initialize(args = {})
12 super(args)
13 end
14 end
15
16 class Element < Item
17 attr_accessor :value
18 attr_reader :null_flavor
19 def initialize(args = {})
20 super(args)
21 self.value = args[:value]
22 self.null_flavor= args[:null_flavor]
23 end
24
25 def null_flavor=(null_flavor)
26 sr = nil
27 if !null_flavor.nil? and
28 null_flavor.defining_code.terminology_id.name == 'openehr'
29 sr = Terminology.find(:first,
30 :conditions => "code = '#{null_flavor.defining_code.code_string}'")
31 end
32 if null_flavor.nil? or (!sr.nil? and sr.group == 'null flavours')
33 @null_flavor = null_flavor
34 else
35 raise ArgumentError, 'null_flavor is invalid'
36 end
37 end
38
39 def is_null?
40 return @value.nil?
41 end
42 end
43 end # of Representation
44 end # of ItemStructure
45 end # of DataStructures
46 end # of RM
47end # of OpenEhr
Note: See TracBrowser for help on using the repository browser.