class RailsAdmin::Config::Proxyable::Proxy

Attributes

bindings[R]

Public Class Methods

new(object, bindings = {}) click to toggle source
# File lib/rails_admin/config/proxyable/proxy.rb, line 11
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 17
def bind(key, value = nil)
  if key.kind_of?(Hash)
    @bindings = key
  else
    @bindings[key] = value
  end
  self
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/rails_admin/config/proxyable/proxy.rb, line 26
def method_missing(name, *args, &block)
  if @object.respond_to?(name)
    reset = @object.instance_variable_get("@bindings")
    begin
      @object.instance_variable_set("@bindings", @bindings)
      response = @object.__send__(name, *args, &block)
    ensure
      @object.instance_variable_set("@bindings", @reset)
    end
    response
  else
    super(name, *args, &block)
  end
end