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.



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

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.



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

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)


76
77
78
79
80
81
82
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 76

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>



45
46
47
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 45

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:



65
66
67
68
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 65

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.



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

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:



55
56
57
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback_collection.rb', line 55

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