Sha256: 7fc3cc1cab04b995fec476392e36427afdf0f8d30d24650bea6eb1b2f21a41c6

Contents?: true

Size: 596 Bytes

Versions: 21

Compression:

Stored size: 596 Bytes

Contents

module CanTango
  class PermissionEngine < Engine
    module Parser
      class Regex < Rule
        attr_reader :regex

        def parse
          target.gsub!(/\/(.*)\//, '\1')
          @regex = /#{target}/
          build_statement
        end

        private

        def targets
          config_models.by_reg_exp(regex)
        end

        def build_statement
          targets.map do |target|
            "#{method} :#{action}, #{target.name}"
          end.join("\n")
        end

        def config_models
          CanTango.config.models
        end

      end
    end
  end
end



Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cantango-0.9.4.7 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.4.6 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.4.5 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.4.3 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.4.2 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.4.1 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.4 lib/cantango/permission_engine/parser/regex.rb
cantango-0.9.3.2 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.9.5 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.9.4 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.9.3 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.9.2 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.9.1 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.9 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.8.1 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.8 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.7 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.6.2 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.6.1 lib/cantango/permission_engine/parser/regex.rb
cantango-0.8.6 lib/cantango/permission_engine/parser/regex.rb