Sha256: 28d7a7659c2b40e7cd036bb30c8d8fe39933371305173ef5375b7c705a2f0dad

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module Trailblazer
  class Finder
    module Activity
      module Prepare
        # Params Activity
        module Params
          extend Trailblazer::Activity::Railway()

          module_function

          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 method(:validate_params), id: :validate_params
          fail method(:invalid_params_error), id: :invalid_params_error
          step method(:set_params), id: :set_params
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trailblazer-finder-0.3.0 lib/trailblazer/finder/activity/prepare/params.rb
trailblazer-finder-0.2.7 lib/trailblazer/finder/activity/prepare/params.rb
trailblazer-finder-0.2.6 lib/trailblazer/finder/activity/prepare/params.rb
trailblazer-finder-0.2.5 lib/trailblazer/finder/activity/prepare/params.rb