Sha256: 3ad04821a3308999ae2d54c0a39fd2e7e00b921d824420e011346138714e05a4

Contents?: true

Size: 507 Bytes

Versions: 41

Compression:

Stored size: 507 Bytes

Contents

module Rasti
  class App
    class Permission < String

      SEPARATOR = '.'

      def initialize(*args)
        super Array(args).flatten.map(&:to_s).join(SEPARATOR)
      end

      def include?(permission)
        other = Permission.new permission
        sections.count <= other.sections.count && self == other.sections.take(sections.count).join(SEPARATOR)
      end

      def sections
        split SEPARATOR
      end

      def last_section
        sections.last
      end
      
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
rasti-app-11.0.0 lib/rasti/app/permission.rb
rasti-app-10.0.1 lib/rasti/app/permission.rb
rasti-app-10.0.0 lib/rasti/app/permission.rb
rasti-app-9.0.0 lib/rasti/app/permission.rb
rasti-app-8.0.1 lib/rasti/app/permission.rb
rasti-app-8.0.0 lib/rasti/app/permission.rb
rasti-app-7.1.1 lib/rasti/app/permission.rb
rasti-app-7.1.0 lib/rasti/app/permission.rb
rasti-app-7.0.2 lib/rasti/app/permission.rb
rasti-app-7.0.1 lib/rasti/app/permission.rb
rasti-app-7.0.0 lib/rasti/app/permission.rb
rasti-app-6.0.1 lib/rasti/app/permission.rb
rasti-app-6.0.0 lib/rasti/app/permission.rb
rasti-app-5.0.0 lib/rasti/app/permission.rb
rasti-app-4.0.2 lib/rasti/app/permission.rb
rasti-app-4.0.1 lib/rasti/app/permission.rb
rasti-app-4.0.0 lib/rasti/app/permission.rb
rasti-app-3.0.0 lib/rasti/app/permission.rb
rasti-app-2.2.4 lib/rasti/app/permission.rb
rasti-app-2.2.3 lib/rasti/app/permission.rb