Sha256: ab4cdf57034ffbaa7aff62cdf5eb367f97e5a4e491b8c0455e1272231bd5ecdf
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
module CanTango module PermissionEngine module Parser class Category < Rule # remove the '@' prefix to get the category name # look up the category and get models referenced by said category attr_reader :categories def initialize method, action, target super load_categories end def parse cat_name = target.gsub(/^\^/, '').to_sym targets = category_models_for(cat_name).map{|model| parse_class(model)} targets.inject([]) do |statements, target| statements << "#{method}(:#{action}, #{target})" end end def category_models_for name categories.registered[name.to_s] end def load_categories @categories = CanTango::PermissionEngine::Loader::Categories.new.categories 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/category.rb |