Sha256: d093c1331e48e7848cb21388deb3d9310a38d67317a2f302e11c26dc34817620

Contents?: true

Size: 580 Bytes

Versions: 7

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

module Macros
  class Contract
    class ExtractParams < Macros::Base
      # @return [Macros::Contract::ExtractParams] step macro instance
      # @param from [Hash] key in params
      # @example scope not passed
      #   Macros::Contract::ExtractParams(from: :scope)

      def initialize(from:)
        @from = from
      end

      def call(ctx, **)
        return false unless ctx[:params]

        scope = ctx[@from]
        return false unless scope

        ctx['contract.default.params'] = ctx[:params][scope]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ff-tbl-macros-2.0.2 lib/macros/contract/extract_params.rb
ff-tbl-macros-2.0.1 lib/macros/contract/extract_params.rb
ff-tbl-macros-2.0.0 lib/macros/contract/extract_params.rb
ff-tbl-macros-1.0.2 lib/macros/contract/extract_params.rb
ff-tbl-macros-1.0.1 lib/macros/contract/extract_params.rb
ff-tbl-macros-1.0.0 lib/macros/contract/extract_params.rb
ff-tbl-macros-0.1.8 lib/macros/contract/extract_params.rb