Class: ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
- Inherits:
-
Object
- Object
- ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
- Defined in:
- lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Boolead
-
#call ⇒ Object
(also: #yield, #[], #===)
Can be any type.
- #call_in_context(context) ⇒ ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
- #call_in_context_with_arguments(context, *args, **kwargs, &block) ⇒ ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
- #call_in_context_with_value_and_arguments(context, value, *args, **kwargs, &block) ⇒ ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
- #called? ⇒ Boolean
- #initialize(types:, block:) ⇒ void constructor
- #not_called? ⇒ Boolean
- #to_proc ⇒ Proc
Constructor Details
#initialize(types:, block:) ⇒ void
26 27 28 29 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 26 def initialize(types:, block:) @types = Entities::TypeCollection.new(types: types) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
19 20 21 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 19 def block @block end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
13 14 15 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 13 def types @types end |
Instance Method Details
#==(other) ⇒ Boolead
102 103 104 105 106 107 108 109 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 102 def ==(other) return unless other.instance_of?(self.class) return false if types != other.types return false if block&.source_location != other.block&.source_location true end |
#call ⇒ Object Also known as: yield, [], ===
Returns Can be any type.
48 49 50 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 48 def call(...) call_callback(...) end |
#call_in_context(context) ⇒ ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
71 72 73 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 71 def call_in_context(context) call_callback_in_context(context) end |
#call_in_context_with_arguments(context, *args, **kwargs, &block) ⇒ ConvenientService::Common::Plugins::HasCallbacks::Entities::Callback
82 83 84 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 82 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::HasCallbacks::Entities::Callback
94 95 96 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 94 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
34 35 36 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 34 def called? Utils.to_bool(@called) end |
#not_called? ⇒ Boolean
41 42 43 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 41 def not_called? !called? end |
#to_proc ⇒ Proc
114 115 116 |
# File 'lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb', line 114 def to_proc block end |