Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'active_support/inflector'
- module Model
- class Customer
- class << self
- def create
- puts "Customer.create"
- end
- module Browser
- def create
- puts "Customer::Browser.create"
- end
- end
- module File
- def create
- puts "Customer::File.create"
- end
- end
- end
- end
- end
- class Customer
- class << self
- def method_missing(name,*params,&block)
- puts "Proxy Object"
- c = Class.new(Model::Customer)
- c.instance_eval do
- extend const_get($context) rescue self
- end
- c.send(name)
- end
- end
- end
- $context = "Browser"
- browser = Customer.create
- $context = "File"
- file = Customer.create
- $context = "SOAP"
- soap = Customer.create
Add Comment
Please, Sign In to add comment