class DockerHelper::Proxy
Generic proxy class that allows to call prefixed methods with or without that prefix via method_missing.
Constants
- DEFAULT_PREFIX
Attributes
proxy_prefix[RW]
Public Class Methods
new(prefix = nil)
click to toggle source
# File lib/docker_helper/proxy.rb, line 36 def initialize(prefix = nil) self.proxy_prefix = prefix || self.class::DEFAULT_PREFIX end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/docker_helper/proxy.rb, line 42 def method_missing(method, *args, &block) respond_to_missing?(method) ? send(prefix_method(method), *args, &block) : super end
pool(size = nil, basename = nil, &block)
click to toggle source
# File lib/docker_helper/proxy.rb, line 51 def pool(size = nil, basename = nil, &block) Pool.new(size, basename, self, &block) end
respond_to_missing?(method, _ = false)
click to toggle source
# File lib/docker_helper/proxy.rb, line 47 def respond_to_missing?(method, _ = false) respond_to?(prefix_method(method)) end
Private Instance Methods
prefix_method(method)
click to toggle source
# File lib/docker_helper/proxy.rb, line 57 def prefix_method(method) "#{proxy_prefix}_#{method}" end