Skip to content

Instantly share code, notes, and snippets.

class Class
def with_attr_reader(*args, &b)
with_attr(:attr_reader, *args, &b)
end
def with_attr_writer(*args, &b)
with_attr(:attr_writer, *args, &b)
end
def with_attr_accessor(*args, &b)
class User < Model
include CouchObject::Persistable
include Securable
with_attr_reader :username do
min_read_permission :guest
end
with_attr_reader :email, :password do
min_read_permission :owner
public class Test{
[Serializable]
[Securable]
[ThisPropertyIsAwesome]
public string Name{get; set;}
}
@mrkurt
mrkurt / gist:2303
Created July 24, 2008 21:19
A mixin for creating secured proxy objects based on permission levels
module Securable
def self.included(base)
base.extend(ClassMethods)
end
class Secured
def initialize(p, o)
@o = o
@o.class.methods_with_permissions(p) {|m| define_proxy_method(m)}
end