Sha256: 174f2a6ba97ebdd8d197045cda85c2ac149d2331017a5db7b47b23084f66ef43
Contents?: true
Size: 607 Bytes
Versions: 21
Compression:
Stored size: 607 Bytes
Contents
module CanTango class PermissionEngine < Engine module Parser class Relationship < Rule def parse match = target[/(\w+)#(\w+)=(.+)/] @target = match[$1] lstat = match[$2] rstat = match[$3] model_class = try_class raise "#{model_class} has no ##{lstat}!" if !model_class.new.respond_to?(lstat.to_sym) conditions = ":#{lstat} => #{rstat}" target_and_conditions = [ target, conditions ].compact.join(', ') "#{method}(:#{action}, #{target_and_conditions})" end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems