Giter VIP home page Giter VIP logo

roxy's Introduction

Roxy (A ruby proxy library)

Summary

Roxy is a basic proxy library that lets you quickly create proxies between your ruby objects. Its syntax
is loosely based on Association Extensions in ActiveRecord
as that is a well-known use of proxies.

Please see the CHANGELOG for contribution details.

Roxy has the following dependencies:

  • rspec >= 1.1.4 (for specs only, not runtime)

Installation

To install the roxy gem run the following:

sudo gem install yfactorial-roxy —source http://gems.github.com

And to enable the scopes in your project just require the roxy library and give your object some moxie:

require ‘roxy’ class Person include Roxy::Moxie … end

Usage

See the announcement post for detailed usage examples: http://ryandaigle.com/articles/2008/11/10/implement-ruby-proxy-objects-with-roxy

Here’s a basic example:


  require 'roxy'
  class Person
    include Roxy::Moxie    
    
    attr_accessor :first, :last, :parents 
       
    proxy :parents do
      def divorced?
        proxy_target.size > 1 and proxy_target.collect { |parent| parent.last }.uniq.size > 1
      end
    end
  end

  # Can then invoke your proxy methods directly on parents
  person.parents.divorced?

roxy's People

Contributors

rwdaigle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.