Class: TDAnalytics::CaseSensitivePost

Inherits:
Net::HTTP::Post
  • Object
show all
Defined in:
lib/thinkingdata-ruby/batch_consumer.rb

Overview

内部使用,为了兼容老版本服务端,将 Header 名称限定为小写

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object



96
97
98
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 96

def [](name)
  @header[name.to_s]
end

#[]=(name, val) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 100

def []=(name, val)
  if val
    @header[name.to_s] = [val]
  else
    @header.delete(name.to_s)
  end
end

#capitalize(name) ⇒ Object



108
109
110
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 108

def capitalize(name)
  name
end

#initialize_http_header(headers) ⇒ Object



91
92
93
94
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 91

def initialize_http_header(headers)
  @header = {}
  headers.each{|k,v| @header[k.to_s] = [v] }
end