module OO::LicenseUser

Public Class Methods

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

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

Public Instance Methods

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