Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simply modify methods that take a block to also provide a proxy
Ruby
tree: 3f5ba38c33

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
README.textile
proxy_block.gemspec

README.textile

ProxyBlock

Overview

Simply modify methods that take a block to also provide a proxy

Usage

Example Classes


  class Wrapper

    def hello
      puts 'hello world'
    end

    def wrap(word = 'wrap')
      puts "#{word} start"
      yield
      puts "#{word} end"
    end
    proxy_block :wrap
    
  end

Standard behavior is maintained


  w = Wrapper.new
  w.wrap{ w.hello }
  # => wrap start
  # => hello world
  # => wrap end

Proxy Form


  w = Wrapper.new
  w.wrap.hello
  # => wrap start
  # => hello world
  # => wrap end
Something went wrong with that request. Please try again.