Last change
on this file since 367 was 216, checked in by KOBAYASHI, Shinji, 15 years ago |
move from Test:Unit to RSpec
|
File size:
1.9 KB
|
Rev | Line | |
---|
[189] | 1 | # rm::data_structures::item_structure::representation
|
---|
[186] | 2 | # representation module
|
---|
| 3 | # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109066789167_738055_2581Report.html
|
---|
| 4 | # refs #53
|
---|
[216] | 5 | module OpenEHR
|
---|
[186] | 6 | module RM
|
---|
| 7 | module DataStructures
|
---|
[187] | 8 | module ItemStructure
|
---|
| 9 | module Representation
|
---|
[216] | 10 | class Item < OpenEHR::RM::Common::Archetyped::Locatable
|
---|
[187] | 11 | def initialize(args = {})
|
---|
| 12 | super(args)
|
---|
| 13 | end
|
---|
[186] | 14 | end
|
---|
| 15 |
|
---|
[187] | 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
|
---|
[186] | 24 |
|
---|
[187] | 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
|
---|
[186] | 37 | end
|
---|
[187] | 38 |
|
---|
| 39 | def is_null?
|
---|
| 40 | return @value.nil?
|
---|
[186] | 41 | end
|
---|
| 42 | end
|
---|
[188] | 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
|
---|
[187] | 59 | end # of Representation
|
---|
| 60 | end # of ItemStructure
|
---|
[186] | 61 | end # of DataStructures
|
---|
| 62 | end # of RM
|
---|
[216] | 63 | end # of OpenEHR
|
---|
Note:
See
TracBrowser
for help on using the repository browser.