Class: Fwd::Backend

Inherits:
Object
  • Object
show all
Defined in:
lib/fwd/backend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Backend

Returns a new instance of Backend.



4
5
6
# File 'lib/fwd/backend.rb', line 4

def initialize(url)
  @url = URI(url)
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



2
3
4
# File 'lib/fwd/backend.rb', line 2

def url
  @url
end

Instance Method Details

#closeObject



12
13
14
15
# File 'lib/fwd/backend.rb', line 12

def close
  @sock.close if @sock
  @sock = nil
end

#stream(file) ⇒ Object



8
9
10
# File 'lib/fwd/backend.rb', line 8

def stream(file)
  IO.copy_stream file.to_s, sock
end

#to_sObject



17
18
19
# File 'lib/fwd/backend.rb', line 17

def to_s
  url.to_s
end