Class: Protocol::HTTP::Header::Split

Inherits:
Array
  • Object
show all
Defined in:
lib/protocol/http/header/split.rb

Overview

Header value which is split by commas.

Direct Known Subclasses

CacheControl, Connection, ETags, Vary

Constant Summary collapse

COMMA =
/\s*,\s*/

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Split



13
14
15
16
17
18
19
# File 'lib/protocol/http/header/split.rb', line 13

def initialize(value)
  if value
    super(value.split(COMMA))
  else
    super([])
  end
end

Instance Method Details

#<<(value) ⇒ Object



21
22
23
# File 'lib/protocol/http/header/split.rb', line 21

def << value
  self.push(*value.split(COMMA))
end

#to_sObject



25
26
27
# File 'lib/protocol/http/header/split.rb', line 25

def to_s
  join(",")
end