Class: ConvenientService::Common::Plugins::HasCallbacks::Entities::TypeCollection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(types:) ⇒ TypeCollection

Returns a new instance of TypeCollection.



11
12
13
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/type_collection.rb', line 11

def initialize(types:)
  @types = types.map(&Entities::Type.method(:cast!))
end

Instance Attribute Details

#typesObject (readonly)

Returns the value of attribute types.



9
10
11
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/type_collection.rb', line 9

def types
  @types
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/type_collection.rb', line 21

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

  return false if types != other.types

  true
end

#contain_exactly?(other_types) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/type_collection.rb', line 15

def contain_exactly?(other_types)
  other_types = other_types.map(&Entities::Type.method(:cast!))

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