Sha256: 7eca6dbb29b46e10bf1987829ad36e889026437fe0a06ea1dc1938cd2b5c9b8a

Contents?: true

Size: 447 Bytes

Versions: 3

Compression:

Stored size: 447 Bytes

Contents

# frozen_string_literal: true

# 洋葱圈模型的链式调用,需要结合 Meta::RouteDSL::AroundActionBuilder 才可以看到它奇效。

module Meta
  module RouteDSL
    class LinkedAction
      def initialize(current_proc, next_action)
        @current_proc = current_proc
        @next_action = next_action
      end

      def execute(execution)
        execution.instance_exec(@next_action, &@current_proc)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
meta-api-0.0.6 lib/meta/application/linked_action.rb
meta-api-0.0.5 lib/meta/application/linked_action.rb
meta-api-0.0.4 lib/meta/application/linked_action.rb