Class: Checkpoint::Resource::AllOfType

Inherits:
Checkpoint::Resource show all
Defined in:
lib/checkpoint/resource/all_of_type.rb

Overview

Specialized Resource type to represent all entities of a particular type.

Constant Summary

Constants inherited from Checkpoint::Resource

ALL

Instance Attribute Summary collapse

Attributes inherited from Checkpoint::Resource

#entity

Instance Method Summary collapse

Methods inherited from Checkpoint::Resource

all, #all?, #all_of_type, #all_of_type?, #to_resource, #token

Constructor Details

#initialize(type) ⇒ AllOfType

Create a wildcard Resource for a given type



9
10
11
# File 'lib/checkpoint/resource/all_of_type.rb', line 9

def initialize(type)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/checkpoint/resource/all_of_type.rb', line 7

def type
  @type
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Compares with another Resource

Returns:

  • (Boolean)

    true if ‘other` is a Resource and its #type matches.



21
22
23
# File 'lib/checkpoint/resource/all_of_type.rb', line 21

def eql?(other)
  other.is_a?(Resource) && type == other.type
end

#idObject

This is always the special ALL resource ID



14
15
16
# File 'lib/checkpoint/resource/all_of_type.rb', line 14

def id
  Resource::ALL
end