Sha256: a786812b8aaa8d53ea54e3e543cee0d63ba89f502e2d3d5a7b5acbd9ce52c33d

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

module CanTango
  module PermissionEngine
    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

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 lib/cantango/permission_engine/parser/regex.rb