openehr 1.2.11 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ module OpenEHR
7
7
  attr_accessor :parent
8
8
 
9
9
  def initialize(args = { })
10
- self.path = args[:path]
10
+ self.path = args[:path] if args[:path]
11
11
  self.parent = args[:parent]
12
12
  end
13
13
 
@@ -18,26 +18,24 @@ module OpenEHR
18
18
  @path = path
19
19
  end
20
20
 
21
- def has_path?(path)
22
- return @path.include?(path)
21
+ def has_path?(search_path)
22
+ path.include?(search_path)
23
23
  end
24
24
 
25
25
  def congruent?
26
- if @path.index(@parent.path) == 0
27
- return true
28
- else
29
- return false
30
- end
26
+ path.index(@parent.path) == 0
31
27
  end
32
28
 
33
29
  alias is_congruent? congruent?
34
30
 
35
31
  def node_conforms_to?(other)
36
- if @path.index(other.path) == 0
37
- return true
38
- else
39
- return false
40
- end
32
+ path.index(other.path) == 0
33
+ end
34
+
35
+ protected
36
+
37
+ def parent_path
38
+ parent ? parent.path : ''
41
39
  end
42
40
  end
43
41
 
@@ -111,6 +109,12 @@ module OpenEHR
111
109
  end
112
110
  @occurrences = occurrences
113
111
  end
112
+
113
+ def path
114
+ super || (left = (parent_path == '' ? '/' : parent_path);
115
+ right = (node_id && left != '/' ? '[' + node_id + ']' : '');
116
+ left + right)
117
+ end
114
118
  end
115
119
 
116
120
  class CAttribute < ArchetypeConstraint
@@ -139,10 +143,15 @@ module OpenEHR
139
143
 
140
144
  def children=(children)
141
145
  @children = children.inject([]) do |array, child|
142
- child.parent=self
146
+ child.parent = self
143
147
  array << child
144
148
  end if children
145
149
  end
150
+
151
+ def path
152
+ super || (left = (parent_path == '/' ? '/' : parent_path + '/');
153
+ left + rm_attribute_name)
154
+ end
146
155
  end
147
156
 
148
157
  class CDefinedObject < CObject
@@ -206,6 +215,14 @@ module OpenEHR
206
215
  self.attributes = args[:attributes]
207
216
  end
208
217
 
218
+ def attributes=(attributes)
219
+ @attributes = attributes.inject([]) do |array, child|
220
+ child.parent = self
221
+ array << child
222
+ end if attributes
223
+ @attributes = [] if attributes.nil?
224
+ end
225
+
209
226
  def any_allowed?
210
227
  return (@attributes.nil? or @attributes.empty?)
211
228
  end
@@ -25,7 +25,6 @@ module OpenEHR
25
25
 
26
26
  def parse
27
27
  archetype_id = OpenEHR::RM::Support::Identification::ArchetypeID.new(:value => @result.archetype_id)
28
- definition = @result.definition
29
28
  ontology = @result.ontology
30
29
  original_language = nil
31
30
  if @result.original_language
@@ -1,3 +1,3 @@
1
1
  module OpenEHR
2
- VERSION = "1.2.11"
2
+ VERSION = "1.2.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openehr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.11
4
+ version: 1.2.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-05-23 00:00:00.000000000 Z
16
+ date: 2013-05-28 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake
@@ -159,38 +159,6 @@ dependencies:
159
159
  - - '>='
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
- - !ruby/object:Gem::Dependency
163
- name: sqlite3
164
- requirement: !ruby/object:Gem::Requirement
165
- none: false
166
- requirements:
167
- - - '>='
168
- - !ruby/object:Gem::Version
169
- version: '0'
170
- type: :runtime
171
- prerelease: false
172
- version_requirements: !ruby/object:Gem::Requirement
173
- none: false
174
- requirements:
175
- - - '>='
176
- - !ruby/object:Gem::Version
177
- version: '0'
178
- - !ruby/object:Gem::Dependency
179
- name: activerecord
180
- requirement: !ruby/object:Gem::Requirement
181
- none: false
182
- requirements:
183
- - - '>='
184
- - !ruby/object:Gem::Version
185
- version: '0'
186
- type: :runtime
187
- prerelease: false
188
- version_requirements: !ruby/object:Gem::Requirement
189
- none: false
190
- requirements:
191
- - - '>='
192
- - !ruby/object:Gem::Version
193
- version: '0'
194
162
  - !ruby/object:Gem::Dependency
195
163
  name: rspec
196
164
  requirement: !ruby/object:Gem::Requirement