class Macros::Contract::ExtractParams

Public Class Methods

new(from:) click to toggle source

@return [Macros::Contract::ExtractParams] step macro instance @param from [Hash] key in params @example scope not passed

Macros::Contract::ExtractParams(from: :scope)
# File lib/macros/contract/extract_params.rb, line 11
def initialize(from:)
  @from = from
end

Public Instance Methods

call(ctx, **) click to toggle source
# File lib/macros/contract/extract_params.rb, line 15
def call(ctx, **)
  return false unless ctx[:params]

  scope = ctx[@from]
  return false unless scope

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