Class: Obo::Header
- Inherits:
-
Object
- Object
- Obo::Header
- Defined in:
- lib/obo/header.rb
Instance Attribute Summary collapse
-
#tagvalues ⇒ Object
readonly
Returns the value of attribute tagvalues.
Instance Method Summary collapse
- #[](tag) ⇒ Object
- #add(tag, value) ⇒ Object
-
#initialize ⇒ Header
constructor
A new instance of Header.
Constructor Details
#initialize ⇒ Header
Returns a new instance of Header.
5 6 7 |
# File 'lib/obo/header.rb', line 5 def initialize @tagvalues = Hash.new{|h,k| h[k] = []} end |
Instance Attribute Details
#tagvalues ⇒ Object (readonly)
Returns the value of attribute tagvalues.
3 4 5 |
# File 'lib/obo/header.rb', line 3 def tagvalues @tagvalues end |
Instance Method Details
#[](tag) ⇒ Object
9 10 11 12 |
# File 'lib/obo/header.rb', line 9 def [](tag) values = @tagvalues[tag] values.length == 1 ? values.first : values end |
#add(tag, value) ⇒ Object
14 15 16 |
# File 'lib/obo/header.rb', line 14 def add(tag,value) @tagvalues[tag] << value end |