Class: FileProxy::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/file_proxy/proxy.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme) ⇒ Proxy

Returns a new instance of Proxy.



3
4
5
6
7
# File 'lib/file_proxy/proxy.rb', line 3

def initialize scheme
  self.class.instance_eval do
    include proxy_for scheme
  end
end

Class Method Details

.proxy_for(scheme) ⇒ Object



9
10
11
12
13
14
# File 'lib/file_proxy/proxy.rb', line 9

def self.proxy_for scheme
  return Proxies::FileProxy if scheme.nil?
  proxy = scheme.dup
  proxy[0] = proxy[0].upcase
  Proxies.const_get "#{proxy}Proxy"
end