Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kairichard/method_ni
This is a simple plugin which supports "class/instance.methods" being held inside of records
https://github.com/kairichard/method_ni
Last synced: 1 day ago
JSON representation
This is a simple plugin which supports "class/instance.methods" being held inside of records
- Host: GitHub
- URL: https://github.com/kairichard/method_ni
- Owner: kairichard
- Created: 2008-12-05T02:23:25.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2010-05-07T10:31:00.000Z (over 14 years ago)
- Last Synced: 2023-04-12T15:06:44.019Z (almost 2 years ago)
- Language: Ruby
- Homepage: kairichardkoenig.de
- Size: 107 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
= method_ni
method_ni is a simple extension for ActiveRecord. You can easily store methods inside of records and evalute them on demand.
I'll give a short example:= Usage
In your model:
class Service < ActiveRecord::Base
has_method_in :custom_method
validates_syntax_of :custom_method
end
In your controller:
class OuterAccountsController < ApplicationController
def create
Service.create :custom_method => %{def one;1;end}
end
def show
@service = Service.find(1)
@service.apply_methods!
@service.applied_methods => ["one"]
result = @service.one
end
end= Install
ruby script/plugin intall git://github.com/kairichard/method_ni.git
= Misc
Tests can be run outside of Rails