Class: ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::CallbackCollection

Inherits:
Object
  • Object
show all
Includes:
Support::Delegate, Enumerable
Defined in:
lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::Delegate::ClassMethodsForForwardable

#delegate

Constructor Details

#initializevoid

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.



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

def initialize
  @callbacks = []
end

Instance Attribute Details

#callbacksObject (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.



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

def callbacks
  @callbacks
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)


71
72
73
74
75
76
77
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 71

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

  return false if callbacks != other.callbacks

  true
end

#callback_classClass<ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback>



40
41
42
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 40

def callback_class
  Entities::Callback
end

#create(**kwargs) ⇒ ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback

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:

  • kwargs (Hash{Symbol => Object})

Returns:



60
61
62
63
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 60

def create(**kwargs)
  Entities::Callback.new(**kwargs)
    .tap { |callback| callbacks << callback }
end

#eachArray<ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback>

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.



26
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 26

delegate :each, to: :callbacks

#for(types) ⇒ Array<ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback>

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>)

Returns:



50
51
52
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 50

def for(types)
  callbacks.select { |callback| callback.types.contain_exactly?(types) }
end