Changeset 187 for ruby/branches/0.5
- Timestamp:
- Aug 11, 2009, 11:52:14 PM (15 years ago)
- Location:
- ruby/branches/0.5
- Files:
-
- 1 added
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5/lib/open_ehr/rm/data_structures/item_structure/representation.rb
r186 r187 6 6 module RM 7 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' 8 module ItemStructure 9 module Representation 10 class Item < OpenEhr::RM::Common::Archetyped::Locatable 11 def initialize(args = {}) 12 super(args) 35 13 end 36 14 end 37 15 38 def is_null? 39 return @value.nil? 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 40 42 end 41 end 42 end # of Representation43 end # of Representation 44 end # of ItemStructure 43 45 end # of DataStructures 44 46 end # of RM -
ruby/branches/0.5/test/unit/lib/open_ehr/rm/data_structures/tc_representation.rb
r186 r187 1 1 # refs #53 2 include OpenEhr::RM::DataStructures:: Representation2 include OpenEhr::RM::DataStructures::ItemStructure::Representation 3 3 include OpenEhr::RM::DataTypes::Text 4 4 include OpenEhr::RM::Support::Identification
Note:
See TracChangeset
for help on using the changeset viewer.