Class: ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback
- Inherits:
-
Object
- Object
- ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback
- Defined in:
- lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#source_location ⇒ Object
readonly
Returns the value of attribute source_location.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Boolean?
-
#call ⇒ Object
(also: #yield, #[], #===)
Can be any type.
- #call_in_context(context) ⇒ ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback
- #call_in_context_with_arguments(context, *args, **kwargs, &block) ⇒ ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback
- #call_in_context_with_value_and_arguments(context, value, *args, **kwargs, &block) ⇒ ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback
- #called? ⇒ Boolean
- #initialize(types:, block:, **extra_kwargs) ⇒ void constructor
- #not_called? ⇒ Boolean
- #source_location_joined_by_colon ⇒ String
- #to_proc ⇒ Proc
Constructor Details
#initialize(types:, block:, **extra_kwargs) ⇒ void
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
#block ⇒ Object (readonly)
Returns the value of attribute block.
24 25 26 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 24 def block @block end |
#source_location ⇒ Object (readonly)
Returns the value of attribute source_location.
30 31 32 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 30 def source_location @source_location end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
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?
125 126 127 128 129 130 131 132 133 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 125 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 |
#call ⇒ Object Also known as: yield, [], ===
Returns Can be any type.
71 72 73 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 71 def call(...) call_callback(...) end |
#call_in_context(context) ⇒ ConvenientService::Common::Plugins::CanHaveCallbacks::Entities::Callback
94 95 96 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 94 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
105 106 107 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 105 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
117 118 119 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 117 def call_in_context_with_value_and_arguments(context, value, *args, **kwargs, &block) call_callback_in_context(context, value, arguments(*args, **kwargs, &block)) end |
#called? ⇒ Boolean
57 58 59 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 57 def called? Utils.to_bool(@called) end |
#not_called? ⇒ Boolean
64 65 66 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 64 def not_called? !called? end |
#source_location_joined_by_colon ⇒ String
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_proc ⇒ Proc
138 139 140 |
# File 'lib/convenient_service/common/plugins/can_have_callbacks/entities/callback.rb', line 138 def to_proc block end |