logo       

Re: Re: RESTful mixin, mixin repo?: msg#00022

lang.ruby.camping.general

Subject: Re: Re: RESTful mixin, mixin repo?

This is what I though. Equipment seems pretty complicated but it is
not really. What's complicated is the extension mechanism that was
created to support many use cases. If you overlook that, the rest is
pretty simple.

Basically, to create a Camping equipment, you do the following :

module YourExtension
extend Equipment # installs the hooks
depends_on OtherExtension # make sure the other extension is included first

# Here you mimic your app's structure. class methods are defined
with a module
# called like your constant + ClassMethods. Like ControllersClassMethods.

module Controllers # controllers will get copied over to your app
class Woot # R is not available
end
end

module Helpers # new helper
def hello
end
end

module CClassMethods # class methods for your app
def create # the create method is chained
super
# do something
end
end

end

in your app :

require 'equipment'
Camping.goes :YourApp
module YourApp
equip YourExtension
end

Maybe I should put that more in form an make a tutorial.

--
Cheers,
zimbatm

http://zimbatm.oree.ch


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise