mesh-medical-subject-headings 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1779cff991e94c43a9adf2429b4ec0c487c2d0b4
4
- data.tar.gz: 4ef7e94c5f20c098648bcb1a1a8874e1c4905b8c
3
+ metadata.gz: 9536958aba4f9e6c5d022f6180f5f3af98fee4b4
4
+ data.tar.gz: 7d14f05245143439b2b0f28629ceb805afb83141
5
5
  SHA512:
6
- metadata.gz: 0cf3b2a10bec165bf2652cd0d8ece4ab04900c8743c052ed9174e05526ccbb35cce6e68ac66e9703060e726aaa3c3e7aac77e360e80f57b5f3b235648f4efaaa
7
- data.tar.gz: d8a2662c49f5235c8a0aa0165fe1188b2ab6a9a347f66b23dfd99f1cee40d7b1b91a2f6e3b48dc002d73e566db7ab9fc9fa7033956dcc78f2e6f316c187e87d5
6
+ metadata.gz: 08ca55381c6a598544df5ed90cc1187d4fd021d184ed40cca1c0953f0a8d06e6114debf6e6a47bfecc872d879d67ba3f6a4e428fc0c60b4ea34a8d9c9fee3a03
7
+ data.tar.gz: 0a1cd8123ef2680ac7dd6fb4b027ff0ba4fcd41bac2be3fbef161a8ace226d14196eaeee9ea73ccd9c9dcdca139a59ab4e2bb5b8cb5b4f18eedcfa05392a6ee9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ #2.0.5 / 2014-06-25
2
+ * [FEATURE] Improve performance of linkify_summaries further.
3
+
1
4
  #2.0.4 / 2014-06-25
2
5
  * [FEATURE] tree can now linkify_summaries for all headings. Performance optimisations to make this viable.
3
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mesh-medical-subject-headings (2.0.4)
4
+ mesh-medical-subject-headings (2.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/MESH/heading.rb CHANGED
@@ -10,33 +10,27 @@ module MESH
10
10
  end
11
11
 
12
12
  def original_heading(locale = default_locale)
13
- return @original_heading[locale]
13
+ @original_heading[locale]
14
14
  end
15
15
 
16
16
  def natural_language_name(locale = default_locale)
17
- return @natural_language_name[locale]
17
+ @natural_language_name[locale]
18
18
  end
19
19
 
20
20
  def summary(locale = default_locale)
21
- return @summary[locale]
21
+ @summary[locale]
22
22
  end
23
23
 
24
24
  def linkify_summary
25
25
  return if summary.nil?
26
- @linkified_summary = summary.dup
27
- @linkified_summary.scan(/[A-Z]+[A-Z,\s]+[A-Z]+/).each do |text|
26
+ @linkified_summary = summary.gsub(/[A-Z]+[A-Z,\s]+[A-Z]+/).each do |text|
28
27
  heading = @tree.find_by_entry(text)
29
- if heading
30
- replacement_text = yield text, heading
31
- @linkified_summary.sub!(text, replacement_text)
32
- end
28
+ heading ? yield(text, heading) : text
33
29
  end
34
- @linkified_summary
35
30
  end
36
31
 
37
32
  def entries(locale = default_locale)
38
33
  @entries[locale] ||= []
39
- return @entries[locale]
40
34
  end
41
35
 
42
36
 
@@ -88,7 +82,7 @@ module MESH
88
82
  end
89
83
 
90
84
  def to_s
91
- return "#{unique_id}, #{original_heading}, [#{tree_numbers.join(',')}]"
85
+ "#{unique_id}, #{original_heading}, [#{tree_numbers.join(',')}]"
92
86
  end
93
87
 
94
88
  def inspect
data/lib/MESH/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mesh
2
- VERSION = "2.0.4"
3
- end
2
+ VERSION = "2.0.5"
3
+ end
@@ -144,7 +144,8 @@ module MESH
144
144
 
145
145
  def test_linkify_summary
146
146
  mh = @mesh_tree.find('D001471')
147
- assert_equal 'A condition with damage to the lining of the lower ESOPHAGUS resulting from chronic acid reflux (ESOPHAGITIS, REFLUX). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the INTESTINE or the salmon-pink mucosa of the STOMACH. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to ADENOCARCINOMA of the esophagus.', mh.summary
147
+ original_summary = 'A condition with damage to the lining of the lower ESOPHAGUS resulting from chronic acid reflux (ESOPHAGITIS, REFLUX). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the INTESTINE or the salmon-pink mucosa of the STOMACH. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to ADENOCARCINOMA of the esophagus.'
148
+ assert_equal original_summary, mh.summary
148
149
 
149
150
  found = {
150
151
  'ESOPHAGUS' => false,
@@ -154,15 +155,15 @@ module MESH
154
155
  'ADENOCARCINOMA' => false
155
156
  }
156
157
 
157
- # start = Time.now
158
+ #start = Time.now
158
159
  linkified_summary = mh.linkify_summary do |text, heading|
159
160
  found[text] = true unless heading.nil?
160
161
  "<foo>#{text.downcase}</foo>"
161
162
  end
162
- # finish = Time.now
163
- # puts start
164
- # puts finish
165
- # puts finish - start
163
+ #finish = Time.now
164
+ #puts start
165
+ #puts finish
166
+ #puts finish - start
166
167
 
167
168
  assert_equal 5, found.length
168
169
  assert found['ESOPHAGUS']
@@ -171,6 +172,7 @@ module MESH
171
172
  assert found['STOMACH']
172
173
  assert found['ADENOCARCINOMA']
173
174
 
175
+ assert_equal original_summary, mh.summary
174
176
  assert_equal 'A condition with damage to the lining of the lower <foo>esophagus</foo> resulting from chronic acid reflux (<foo>esophagitis, reflux</foo>). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the <foo>intestine</foo> or the salmon-pink mucosa of the <foo>stomach</foo>. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to <foo>adenocarcinoma</foo> of the esophagus.', linkified_summary
175
177
 
176
178
  end
@@ -738,4 +740,4 @@ ALL there is no increased sensitivity to treatment, but there is increased risk
738
740
  '
739
741
  end
740
742
  end
741
- end
743
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mesh-medical-subject-headings
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Styles