lib/lotus/utils/callbacks.rb in lotus-utils-0.5.2 vs lib/lotus/utils/callbacks.rb in lotus-utils-0.6.0

- old
+ new

@@ -1,7 +1,5 @@ -require 'lotus/utils/deprecation' - module Lotus module Utils # Before and After callbacks # # @since 0.1.0 @@ -58,20 +56,10 @@ end @chain.uniq! end - # @since 0.1.0 - # @deprecated Use Lotus::Utils::Callbacks::Chain#append as it has the - # same effect, but it's more consistent with the new API. - # - # @see Lotus::Utils::Callbacks::Chain#append - def add(*callbacks, &blk) - Utils::Deprecation.new("Lotus::Utils::Callbacks::Chain#add is deprecated, use #append instead.") - append(*callbacks, &blk) - end - # Prepends the given callbacks to the beginning of the chain. # # @param callbacks [Array] one or multiple callbacks to add # @param block [Proc] an optional block to be added # @@ -131,25 +119,25 @@ # # action = Action.new # params = Hash[id: 23] # # chain = Lotus::Utils::Callbacks::Chain.new - # chain.add :authenticate!, :set_article + # chain.append :authenticate!, :set_article # # chain.run(action, params) # # # `params` will only be passed as #set_article argument, because it has an arity greater than zero # # # # chain = Lotus::Utils::Callbacks::Chain.new # - # chain.add do + # chain.append do # # some authentication logic # end # - # chain.add do |params| + # chain.append do |params| # # some other logic that requires `params` # end # # chain.run(action, params) # @@ -172,10 +160,10 @@ # chain = Lotus::Utils::Callbacks::Chain.new # chain.freeze # # chain.frozen? # => true # - # chain.add :authenticate! # => RuntimeError + # chain.append :authenticate! # => RuntimeError def freeze super @chain.freeze end