Class: QcloudVod::Utils

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

Class Method Summary collapse

Class Method Details

.content_size(content) ⇒ Object

计算 content 的大小



10
11
12
13
14
15
16
# File 'lib/qcloud_vod/utils.rb', line 10

def content_size(content)
  if content.respond_to?(:size)
    content.size
  elsif content.is_a?(IO)
    content.stat.size
  end
end

.url_encode(path) ⇒ Object

对 path 进行 url_encode



5
6
7
# File 'lib/qcloud_vod/utils.rb', line 5

def url_encode(path)
  ERB::Util.url_encode(path).gsub('%2F', '/')
end