Last change
on this file since 399 was 216, checked in by KOBAYASHI, Shinji, 15 years ago |
move from Test:Unit to RSpec
|
File size:
1.9 KB
|
Line | |
---|
1 | # rm::data_structures::item_structure::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
|
---|
5 | module 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 |
|
---|
44 | class Cluster < Item
|
---|
45 | attr_reader :items
|
---|
46 |
|
---|
47 | def initialize(args = {})
|
---|
48 | super(args)
|
---|
49 | self.items = args[:items]
|
---|
50 | end
|
---|
51 |
|
---|
52 | def items=(items)
|
---|
53 | if !items.nil? and items.empty?
|
---|
54 | raise ArgumentError, 'items should not empty'
|
---|
55 | end
|
---|
56 | @items = items
|
---|
57 | end
|
---|
58 | end
|
---|
59 | end # of Representation
|
---|
60 | end # of ItemStructure
|
---|
61 | end # of DataStructures
|
---|
62 | end # of RM
|
---|
63 | end # of OpenEHR
|
---|
Note:
See
TracBrowser
for help on using the repository browser.