Sha256: efd65dc50d62149fa4fbda17c4f3509ea3b62f2061c809a9d64fef51c5ddf62f
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
module RailsAdmin module Config class Proxy instance_methods.each {|m| undef_method m unless m =~ /^(__|instance_eval|object_id)/ } attr_reader :bindings def initialize(object, bindings = {}) @object = object @bindings = bindings end # Bind variables to be used by the configuration options def bind(key, value = nil) if key.kind_of?(Hash) @bindings = key else @bindings[key] = value end self end 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 end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
obitum-rails_admin-0.0.1 | lib/rails_admin/config/proxy.rb |
elucid-rails_admin-0.0.1 | lib/rails_admin/config/proxy.rb |