Class: Richard::Internal::BasicHeaderParser

Inherits:
Object
  • Object
show all
Defined in:
lib/richard_iii/internal/curl.rb

Class Method Summary collapse

Class Method Details

.from(text) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/richard_iii/internal/curl.rb', line 25

def from(text)
  lines = text.lines.map(&:chomp).map(&:strip)
  lines.drop(1).take_while{|line| !line.strip.empty?}.map do |line|
    name,value = line.split(':')
    RequestHeader.new name.strip, value.strip
  end
end