graphite-api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,6 +39,7 @@ module GraphiteAPI
39
39
 
40
40
  def socket
41
41
  if @socket.nil? || @socket.closed?
42
+ debug [:connector,[host,port]]
42
43
  @socket = ::TCPSocket.new host, port
43
44
  end
44
45
  @socket
@@ -1,4 +1,5 @@
1
1
  require 'forwardable'
2
+ require 'uri'
2
3
 
3
4
  module GraphiteAPI
4
5
  module Utils
@@ -36,9 +37,14 @@ module GraphiteAPI
36
37
  module_function
37
38
 
38
39
  def expand_host host
39
- host,port = host.split(":")
40
- port = port.nil? ? default_options[:port] : port.to_i
41
- [host,port]
40
+ if host =~ /:\/\//
41
+ uri = URI.parse host
42
+ [ uri.host, uri.port || default_options[:port] ]
43
+ else
44
+ host, port = host.split(":")
45
+ port = port.nil? ? default_options[:port] : port.to_i
46
+ [ host, port]
47
+ end
42
48
  end
43
49
 
44
50
  def default_options
@@ -1,5 +1,5 @@
1
1
  module GraphiteAPI
2
2
  class Version
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphite-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
12
+ date: 2013-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine