Class: Obo::Header
- Inherits:
-
Object
- Object
- Obo::Header
- Defined in:
- lib/obo.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.
8 9 10 |
# File 'lib/obo.rb', line 8 def initialize @tagvalues = Hash.new{|h,k| h[k] = []} end |
Instance Attribute Details
#tagvalues ⇒ Object (readonly)
Returns the value of attribute tagvalues.
6 7 8 |
# File 'lib/obo.rb', line 6 def tagvalues @tagvalues end |
Instance Method Details
#[](tag) ⇒ Object
12 13 14 15 |
# File 'lib/obo.rb', line 12 def [](tag) values = @tagvalues[tag] values.length == 1 ? values.first : values end |
#add(tag, value) ⇒ Object
17 18 19 |
# File 'lib/obo.rb', line 17 def add(tag,value) @tagvalues[tag] << value end |