lib/MESH/heading.rb in mesh-medical-subject-headings-2.0.4 vs lib/MESH/heading.rb in mesh-medical-subject-headings-2.0.5
- old
+ new
@@ -8,37 +8,31 @@
def <=> other
self.unique_id <=> other.unique_id
end
def original_heading(locale = default_locale)
- return @original_heading[locale]
+ @original_heading[locale]
end
def natural_language_name(locale = default_locale)
- return @natural_language_name[locale]
+ @natural_language_name[locale]
end
def summary(locale = default_locale)
- return @summary[locale]
+ @summary[locale]
end
def linkify_summary
return if summary.nil?
- @linkified_summary = summary.dup
- @linkified_summary.scan(/[A-Z]+[A-Z,\s]+[A-Z]+/).each do |text|
+ @linkified_summary = summary.gsub(/[A-Z]+[A-Z,\s]+[A-Z]+/).each do |text|
heading = @tree.find_by_entry(text)
- if heading
- replacement_text = yield text, heading
- @linkified_summary.sub!(text, replacement_text)
- end
+ heading ? yield(text, heading) : text
end
- @linkified_summary
end
def entries(locale = default_locale)
@entries[locale] ||= []
- return @entries[locale]
end
def has_ancestor(heading)
return false if parents.empty?
@@ -86,10 +80,10 @@
end
return true
end
def to_s
- return "#{unique_id}, #{original_heading}, [#{tree_numbers.join(',')}]"
+ "#{unique_id}, #{original_heading}, [#{tree_numbers.join(',')}]"
end
def inspect
to_s
end