Module: Workspace::WorkspaceFile::Net

Extended by:
ActiveSupport::Concern
Included in:
Workspace::WorkspaceFile
Defined in:
lib/workspace/workspace_file/net.rb

Instance Method Summary collapse

Instance Method Details

#download(url) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/workspace/workspace_file/net.rb', line 9

def download(url)
  url = "http:#{url}" if url[0..1] == "//"
  contents = open(url, { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, allow_redirections: :safe }).read
  dir.create unless dir.exists?
  write(contents)
  self
end