Class: Obo::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/obo/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHeader

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

#tagvaluesObject (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