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

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.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:, block:, **extra_kwargs) ⇒ 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:

Since:

  • 1.0.0



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

def initialize(types:, block:, **extra_kwargs)
  @types = Entities::TypeCollection.new(types: types)
  @block = block
  @source_location = extra_kwargs.fetch(:source_location) { block.source_location }
end

Instance Attribute Details

#blockObject (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



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

def block
  @block
end

#source_locationObject (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



30
31
32
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 30

def source_location
  @source_location
end

#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/callback.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



111
112
113
114
115
116
117
118
119
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 111

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

  return false if types != other.types
  return false if block != other.block
  return false if source_location != other.source_location

  true
end

#callObject Also known as: yield, [], ===

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.

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.

Since:

  • 1.0.0



57
58
59
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 57

def call(...)
  call_callback(...)
end

#call_in_context(context) ⇒ 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:

  • context (Object)

    Can be any type.

Returns:

Since:

  • 1.0.0



80
81
82
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 80

def call_in_context(context)
  call_callback_in_context(context)
end

#call_in_context_with_arguments(context, *args, **kwargs, &block) ⇒ 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:

  • context (Object)

    Can be any type.

  • args (Array<Object>)
  • kwargs (Hash{Symbol => Object})
  • block (Proc, nil)

Returns:

Since:

  • 1.0.0



91
92
93
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 91

def call_in_context_with_arguments(context, *args, **kwargs, &block)
  call_callback_in_context(context, arguments(*args, **kwargs, &block))
end

#call_in_context_with_value_and_arguments(context, value, *args, **kwargs, &block) ⇒ 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:

  • context (Object)

    Can be any type.

  • value (Object)

    Can be any type.

  • args (Array<Object>)
  • kwargs (Hash{Symbol => Object})
  • block (Proc, nil)

Returns:

Since:

  • 1.0.0



103
104
105
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 103

def call_in_context_with_value_and_arguments(context, value, *args, **kwargs, &block)
  call_callback_in_context(context, value, arguments(*args, **kwargs, &block))
end

#source_location_joined_by_colonString

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.

Returns:

  • (String)

Since:

  • 1.0.0



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

def source_location_joined_by_colon
  source_location.join(":")
end

#to_procProc

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.

Returns:

  • (Proc)

Since:

  • 1.0.0



124
125
126
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 124

def to_proc
  block
end