class FatModelAuth::CannedGateKeeper
Public Class Methods
allows(method)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 3 def self.allows(method) self.new(method => true) end
build(params)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 11 def self.build(params) self.new(params) end
denies(method)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 7 def self.denies(method) self.new(method => false) end
new(params)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 19 def initialize(params) @map = {} add_rules(params) end
Public Instance Methods
add_rules(params)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 24 def add_rules(params) for param in params response = param.pop @map["to_#{param.pop}?".to_sym] = lambda { response } end end
allows(user)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 15 def allows(user) self end
method_missing(method, *args)
click to toggle source
# File lib/fat_model_auth/canned_gate_keeper.rb, line 31 def method_missing(method, *args) unless @map.has_key? method raise NoMethodError, "undefined method allows(user).#{method} for #{self.class}" end @map[method].call end