Sha256: 516a7217ac333cdc6efdd5e8f3a5ebdeac595b80e8f126c3a2e8a5c726f44c66

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

module Doorkeeper
  module Models
    module Scopes
      def self.included(base)
        base.class_eval do
          define_method :scopes do
            OAuth::Scopes.from_string(self[:scopes])
          end

          define_method :scopes_string do
            OAuth::Scopes.from_string(self[:scopes]).to_s
          end

          define_method :includes_scope? do |required_scopes|
            required_scopes.blank? || required_scopes.any? { |s| scopes.exists?(s) }
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-1.4.2 lib/doorkeeper/models/scopes.rb
doorkeeper-1.4.1 lib/doorkeeper/models/scopes.rb
doorkeeper-1.4.0 lib/doorkeeper/models/scopes.rb