Sha256: 463466e1eae81bfcb93cb1863ee904d3e10aadd32c29c0a6af119e0d06ab0606

Contents?: true

Size: 291 Bytes

Versions: 2

Compression:

Stored size: 291 Bytes

Contents

module Ostiary
  class PolicyLimited < Policy

    def inspect
      "#{name} only for #{rules.to_sentence}"
    end

    def met?(action)
      return true if !rules.include?(action)
      yield
    end

    def error_message(action)
      "#{action} limited by #{name}"
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ostiary-0.9.0 lib/ostiary/policy_limited.rb
ostiary-0.8.0 lib/ostiary/policy_limited.rb