lib/forwardable/extended.rb
def def_ivar_delegator(ivar, alias_ = ivar, **kwd)
      prefix, suffix, wrap = prepare_delegate(**kwd)

      if suffix
        alias_ = alias_.to_s.gsub(
          /\?$/, ""
        )
      end

      class_eval delegate_debug(<<-STR), __FILE__, __LINE__ - 9
        def #{alias_.to_s.gsub(/\A@/, "")}#{suffix}
          #{wrap}(
            #{prefix}#{ivar}
          )

        rescue Exception
          if !Forwardable.debug && $@ && $@.respond_to?(:delete_if)
            $@.delete_if do |source|
              source =~ %r"#{Regexp.escape(__FILE__)}"o
            end
          end

          raise
        end
      STR
    end
def def_ivar_delegator(ivar, alias_ = ivar, **kwd)
      prefix, suffix, wrap = prepare_delegate(**kwd)

      if suffix
        alias_ = alias_.to_s.gsub(
          /\?$/, ""
        )
      end

      class_eval delegate_debug(<<-STR), __FILE__, __LINE__ - 9
        def #{alias_.to_s.gsub(/\A@/, "")}#{suffix}
          #{wrap}(
            #{prefix}#{ivar}
          )

        rescue Exception
          if !Forwardable.debug && $@ && $@.respond_to?(:delete_if)
            $@.delete_if do |source|
              source =~ %r"#{Regexp.escape(__FILE__)}"o
            end
          end

          raise
        end
      STR
    end
def def_ivar_delegator ( ivar , alias_ = ivar , ** kwd ) prefix , suffix , wrap = prepare_delegate ( ** kwd ) if suffix alias_ = alias_ . to_s . gsub ( / \? / , "" ) end class_eval delegate_debug ( <<-STR ) , __FILE__ , __LINE__ - 9 #{ alias_ . to_s . gsub ( / \A / , "" ) } #{ suffix } #{ wrap } #{ prefix } #{ ivar } #{ Regexp . escape ( __FILE__ ) } STR end
------------------------------------------------------------------------
 Delegate a method to an instance variable.
 ------------------------------------------------------------------------
------------------------------------------------------------------------ Delegate a method to an instance variable . ------------------------------------------------------------------------