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 36 def initialize(prefix = nil) 37 self.proxy_prefix = prefix || self.class::DEFAULT_PREFIX 38 end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/docker_helper/proxy.rb 42 def method_missing(method, *args, &block) 43 respond_to_missing?(method) ? 44 send(prefix_method(method), *args, &block) : super 45 end
pool(size = nil, basename = nil, &block)
click to toggle source
# File lib/docker_helper/proxy.rb 51 def pool(size = nil, basename = nil, &block) 52 Pool.new(size, basename, self, &block) 53 end
respond_to_missing?(method, _ = false)
click to toggle source
# File lib/docker_helper/proxy.rb 47 def respond_to_missing?(method, _ = false) 48 respond_to?(prefix_method(method)) 49 end
Private Instance Methods
prefix_method(method)
click to toggle source
# File lib/docker_helper/proxy.rb 57 def prefix_method(method) 58 "#{proxy_prefix}_#{method}" 59 end