Class: ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::TypeCollection Private

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/common/plugins/can_have_callbacks/entities/type_collection.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(types:) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • types (Array<Symbol>)

Since:

  • 1.0.0



24
25
26
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type_collection.rb', line 24

def initialize(types:)
  @types = types.map { |type| Entities::Type.cast!(type) }
end

Instance Attribute Details

#typesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0



18
19
20
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type_collection.rb', line 18

def types
  @types
end

Instance Method Details

#==(other) ⇒ Boolean?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)

Since:

  • 1.0.0



42
43
44
45
46
47
48
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type_collection.rb', line 42

def ==(other)
  return unless other.instance_of?(self.class)

  return false if types != other.types

  true
end

#contain_exactly?(other_types) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other_types (Array<Object>)

Returns:

  • (Boolean)

Since:

  • 1.0.0



32
33
34
35
36
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/type_collection.rb', line 32

def contain_exactly?(other_types)
  other_types = other_types.map { |type| Entities::Type.cast!(type) }

  Utils::Array.contain_exactly?(types, other_types)
end