class RailsAdmin::Config::Proxyable::Proxy

Public Class Methods

new(object, bindings = {}) click to toggle source
# File lib/rails_admin/config/proxyable/proxy.rb, line 7
def initialize(object, bindings = {})
  @object = object
  @bindings = bindings
end

Public Instance Methods

bind(key, value = nil) click to toggle source

Bind variables to be used by the configuration options

# File lib/rails_admin/config/proxyable/proxy.rb, line 13
def bind(key, value = nil)
  if key.is_a?(::Hash)
    @bindings = key
  else
    @bindings[key] = value
  end
  self
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/rails_admin/config/proxyable/proxy.rb, line 22
def method_missing(method_name, *args, &block)
  if @object.respond_to?(method_name)
    reset = @object.bindings
    begin
      @object.bindings = @bindings
      response = @object.__send__(method_name, *args, &block)
    ensure
      @object.bindings = reset
    end
    response
  else
    super(method_name, *args, &block)
  end
end