Sha256: 48df9c2feac7480e3dffc57d49e9882ce7707043db599687ea1700e398053d40

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

# frozen_string_literal: true

module Trailblazer
  class Finder
    module Activities
      # Params Activity
      class PrepareParams < Trailblazer::Activity::Railway
        def validate_params(_ctx, **)
          # Should probably validate some things here at some point
          true
        end

        def invalid_params_error(_ctx, **)
          # (ctx[:errors] ||= []) << {params: "One or more parameters are invalid"}
        end

        def set_params(ctx, **)
          ctx[:params] = ctx[:options][:params] || {}
        end

        step (:validate_params)
        fail (:invalid_params_error)
        step (:set_params)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trailblazer-finder-0.10.2 lib/trailblazer/finder/activities/prepare_params.rb
trailblazer-finder-0.10.1 lib/trailblazer/finder/activities/prepare_params.rb