class Checkpoint::Resource::AnyEntityOfType

Special class to represent any entity of a type. This is used for type-wide grants or checks. It is basically so {AllOfType} can have an entity rather than a nil.

Wildcards or null objects typically have somewhat strange semantics, and this is no exception. It will compare as eql? and == to any object that has the same type attribute.

Attributes

type[R]

Public Class Methods

new(type) click to toggle source

Create a wildcard entity that will compare as equal to

# File lib/checkpoint/resource/any_entity_of_type.rb, line 16
def initialize(type)
  @type = type
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source

Always returns true; this wildcard is “equal” to any object. return [Boolean] true

# File lib/checkpoint/resource/any_entity_of_type.rb, line 22
def eql?(other)
  other.respond_to?(:type) && type == other.type
end
Also aliased as: ==