Sha256: 696d29fbaca0c6a30d0f93b6f20c0e7e003a56aff6d3793125d26168b203fa71
Contents?: true
Size: 965 Bytes
Versions: 13
Compression:
Stored size: 965 Bytes
Contents
# frozen_string_literal: true module RailsAdmin module Config module Proxyable class Proxy < BasicObject 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.is_a?(::Hash) @bindings = key else @bindings[key] = value end self end 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 end end end end
Version data entries
13 entries across 13 versions & 1 rubygems