Class: MESH::Entry
- Inherits:
-
Object
- Object
- MESH::Entry
- Defined in:
- lib/MESH/entry.rb
Instance Attribute Summary collapse
-
#heading ⇒ Object
Returns the value of attribute heading.
-
#lexical_type ⇒ Object
Returns the value of attribute lexical_type.
-
#semantic_relationship ⇒ Object
Returns the value of attribute semantic_relationship.
-
#semantic_types ⇒ Object
Returns the value of attribute semantic_types.
-
#term ⇒ Object
Returns the value of attribute term.
Instance Method Summary collapse
-
#initialize(heading, entry_text) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(heading, entry_text) ⇒ Entry
Returns a new instance of Entry.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/MESH/entry.rb', line 7 def initialize(heading, entry_text) @heading = heading @semantic_types = [] parts = entry_text.split('|') if entry_text.include? '|' key = parts.pop parts.each_with_index do |part, i| case key[i] when 'a' # the term itself @term = part when 'b' # semantic type* @semantic_types << MESH::SemanticTypes[part] when 'c' # lexical type* @lexical_type = MESH::LexicalTypes[part] when 'd' # semantic relation* @semantic_relationship = MESH::SemanticRelationshipTypes[part] when 'e' # thesaurus id when 'f' # date when 's' # sort version when 'v' # entry version end end else @term = entry_text end end |
Instance Attribute Details
#heading ⇒ Object
Returns the value of attribute heading.
5 6 7 |
# File 'lib/MESH/entry.rb', line 5 def heading @heading end |
#lexical_type ⇒ Object
Returns the value of attribute lexical_type.
5 6 7 |
# File 'lib/MESH/entry.rb', line 5 def lexical_type @lexical_type end |
#semantic_relationship ⇒ Object
Returns the value of attribute semantic_relationship.
5 6 7 |
# File 'lib/MESH/entry.rb', line 5 def semantic_relationship @semantic_relationship end |
#semantic_types ⇒ Object
Returns the value of attribute semantic_types.
5 6 7 |
# File 'lib/MESH/entry.rb', line 5 def semantic_types @semantic_types end |
#term ⇒ Object
Returns the value of attribute term.
5 6 7 |
# File 'lib/MESH/entry.rb', line 5 def term @term end |