Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simply modify methods that take a block to also provide a proxy
Ruby
Tree: 4582b411a7

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 }
  # => word start
  # => hello world
  # => world end

Proxy Form

  w = Wrapper.new
  w.wrap.hello

  1. => word start
  2. => hello world
  3. => world end
Something went wrong with that request. Please try again.