Skip to content
This repository

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

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 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.