module OO::LicenceUser

Public Class Methods

included(base) click to toggle source
# File lib/oo/licence_user.rb, line 3
def self.included(base)
  base.class_eval do
    field :licence_keys, type: :array,
                         default: OO.configuration.default_licence_keys

    def licensed?(attrs = {})
      required_key = attrs.fetch(:to)
      CheckLicence.call(key: required_key, in: licence_keys).any?
    end
  end
end

Public Instance Methods

licensed?(attrs = {}) click to toggle source
# File lib/oo/licence_user.rb, line 8
def licensed?(attrs = {})
  required_key = attrs.fetch(:to)
  CheckLicence.call(key: required_key, in: licence_keys).any?
end