Sha256: 686ab27ec256612031cabbc7ea247e7254984bc38ee4973b20eab5ce0679e201
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
# frozen_string_literal: true # @api public # @since 0.1.0 class SmartCore::Operation::Result::Callback < SmartCore::Operation::Result::Basic # @return [NilClass] # # @api private # @since 0.1.0 EMPTY_INVOKATION_CONTEXT = nil # @return [Proc] # # @api public # @since 0.1.0 alias_method :callback, :__result_block__ public :callback # @param context [Any] # @return [Any] # # @api public # @since 0.1.0 def call(context = EMPTY_INVOKATION_CONTEXT) context == EMPTY_INVOKATION_CONTEXT ? callback.call : context.instance_eval(&callback) end # @yield [SmartCore::Operation::Result::Callback] # @return [Boolean] # # @api public # @since 0.1.0 def callback? true.tap { yield(self) if block_given? } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
smart_operation-0.2.0 | lib/smart_core/operation/result/callback.rb |
smart_operation-0.1.0 | lib/smart_core/operation/result/callback.rb |