Sha256: bdf0ebfc89c528a597b8244970aac2ac8b456053f8b2d9be8af5964592c0f718
Contents?: true
Size: 599 Bytes
Versions: 1
Compression:
Stored size: 599 Bytes
Contents
module CanTango module PermissionEngine 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cantango-0.8.0 | lib/cantango/permission_engine/parser/relationship.rb |