Class: FirstLine

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ FirstLine

Returns a new instance of FirstLine.



2
3
4
# File 'lib/http_header.rb', line 2

def initialize(tokens)
  @tokens = tokens
end

Class Method Details

.read(line) ⇒ Object



19
20
21
# File 'lib/http_header.rb', line 19

def FirstLine.read(line)
  FirstLine.new line.split(%r{\s+}, 3)
end

Instance Method Details

#[](key) ⇒ Object



6
7
8
# File 'lib/http_header.rb', line 6

def [](key)
  @tokens[key]
end

#[]=(key, value) ⇒ Object



10
11
12
# File 'lib/http_header.rb', line 10

def []=(key, value)
  @tokens[key] = value
end

#to_sObject



14
15
16
# File 'lib/http_header.rb', line 14

def to_s
  @tokens.join(' ')
end