Class: OboParser::OboParser::Stanza
- Inherits:
-
Object
- Object
- OboParser::OboParser::Stanza
- Defined in:
- lib/obo_parser.rb
Overview
A collection of single lines (Tags)
Instance Attribute Summary collapse
-
#def ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags.
-
#id ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags.
-
#name ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags.
-
#other_tags ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags.
Instance Method Summary collapse
-
#initialize(tags) ⇒ Stanza
constructor
A new instance of Stanza.
-
#tags_named(tag_name = nil) ⇒ Object
Convienience methods.
Constructor Details
#initialize(tags) ⇒ Stanza
Returns a new instance of Stanza.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/obo_parser.rb', line 58 def initialize() @other_tags = [] while .length != 0 t = .shift new_tag = OboParser::Tag.new new_tag.tag = t.tag new_tag.value = t.value new_tag.comment = t.comment new_tag.xrefs = t.xrefs case new_tag.tag when 'id' @id = new_tag when 'name' @name = new_tag when 'def' @def = new_tag else if new_tag.tag == 'relationship' new_tag. = t. new_tag.relation = t.relation end @other_tags.push(new_tag) end end end |
Instance Attribute Details
#def ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags
56 57 58 |
# File 'lib/obo_parser.rb', line 56 def def @def end |
#id ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags
56 57 58 |
# File 'lib/obo_parser.rb', line 56 def id @id end |
#name ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags
56 57 58 |
# File 'lib/obo_parser.rb', line 56 def name @name end |
#other_tags ⇒ Object
Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags
56 57 58 |
# File 'lib/obo_parser.rb', line 56 def @other_tags end |
Instance Method Details
#tags_named(tag_name = nil) ⇒ Object
Convienience methods
91 92 93 94 95 96 97 98 |
# File 'lib/obo_parser.rb', line 91 def (tag_name = nil) return nil if tag_name.nil? result = [] @other_tags.each do |t| result.push(t) if (t.tag == tag_name) end result end |