Sha256: 3b22d573125b280d4d4f2c1fb03e4991cf68f6b214451e0e986dd129da8a95da

Contents?: true

Size: 405 Bytes

Versions: 7

Compression:

Stored size: 405 Bytes

Contents

# frozen_string_literal: true

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

module Meta
  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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
meta-api-0.2.0 lib//meta/application/linked_action.rb
meta-api-0.1.2 lib//meta/application/linked_action.rb
meta-api-0.1.1 lib//meta/application/linked_action.rb
meta-api-0.1.0 lib//meta/application/linked_action.rb
meta-api-0.0.9 lib//meta/application/linked_action.rb
meta-api-0.0.8 lib/meta/application/linked_action.rb
meta-api-0.0.7 lib/meta/application/linked_action.rb