Sha256: 565708946e206dce58becdfcb1cfb5ddb4bfd2d75eb5c042712aaa431d207821
Contents?: true
Size: 1008 Bytes
Versions: 12
Compression:
Stored size: 1008 Bytes
Contents
# frozen_string_literal: true module LunaPark module Extensions ## # class-level mixin # # The Callable interface is a generic interface # containing a single `call()` method - which returns # a generic value # # @example # class MyCallableObject < LunaPark::Extensions::Callable # def initialize(params) # @params = params # end # # def call # # do some stuff with @params # 'call used' # end # # def call! # # do some stuff with @params # 'call! used' # end # end # # MyCallableObject.call(params) # => 'call used' # MyCallableObject.call!(params) # => 'call! used' module Callable # Preferred class method to run instance `call` method def call(*args) new(*args).call end ## # Preferred class method to run instance `call`! method def call!(*args) new(*args).call! end end end end
Version data entries
12 entries across 12 versions & 1 rubygems