Sha256: 618157d1ee3ce1c12e1bd011f1506ff26773f6986fcf5a3b528fbb8afe9a76fe

Contents?: true

Size: 432 Bytes

Versions: 7

Compression:

Stored size: 432 Bytes

Contents

# frozen_string_literal: true

module Macros
  class Ctx
    class ValidatePresence < Macros::Base
      # Check if the key set in the context
      # @param key [Symbol]
      # @example key not passed
      #   Macros::Contract::ExtractParams()
      def initialize(key)
        @key = key
      end

      # @param ctx [Trailblazer::Skill] tbl context hash
      def call(ctx, **)
        !!ctx[@key]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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