Sha256: ca87991df117a93a5e04d798af029dd4f1ad661b9b1a6e0286a426783f115202

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

# encoding: utf-8

require "active_model"

require_relative "policy/version"

require_relative "policy/base"
require_relative "policy/base/node"
require_relative "policy/base/and"
require_relative "policy/base/or"
require_relative "policy/base/xor"
require_relative "policy/base/not"
require_relative "policy/base/negator"

require_relative "policy/follower"
require_relative "policy/follower/name_error"
require_relative "policy/follower/policies"
require_relative "policy/follower/violation_error"

# The namespace for the code of the 'policy' gem
module Policy

  # Builds a composite policy by applying method AND to policies
  #
  # @param [Policy::Base, Array<Policy::Base>] policies
  #
  # @return [Policy::Base]
  def self.and(*policies)
    Base::And.new(*policies)
  end

  # Builds a composite policy by applying method OR to policies
  #
  # @param [Policy::Base, Array<Policy::Base>] policies
  #
  # @return [Policy::Base]
  def self.or(*policies)
    Base::Or.new(*policies)
  end

  # Builds a composite policy by applying method XOR to policies
  #
  # @param [Policy::Base, Array<Policy::Base>] policies
  #
  # @return [Policy::Base]
  def self.xor(*policies)
    Base::Xor.new(*policies)
  end

  # Builds the negation of policy
  #
  # @param [Policy::Base] policy
  #
  # @return [Policy::Base]
  def self.not(policy)
    Base::Not.new(policy)
  end

end # module Policy

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
policy-2.0.0 lib/policy.rb