Sha256: b64f0698ad6383f8fc35d15c121e8ff01fa06b6a4408d2e15d60eee5402e8d8f

Contents?: true

Size: 395 Bytes

Versions: 87

Compression:

Stored size: 395 Bytes

Contents

require 'cli/kit'

module CLI
  module Kit
    module Autocall
      def autocall(const, &block)
        @autocalls ||= {}
        @autocalls[const] = block
      end

      def const_missing(const)
        block = begin
          @autocalls.fetch(const)
                rescue KeyError
                  return super
        end
        const_set(const, block.call)
      end
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
shopify-cli-2.36.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.35.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.34.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.33.1 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.33.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.32.1 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.32.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.31.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.30.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.29.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.28.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.27.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.26.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.25.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.24.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.23.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.22.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.21.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.20.1 vendor/deps/cli-kit/lib/cli/kit/autocall.rb
shopify-cli-2.20.0 vendor/deps/cli-kit/lib/cli/kit/autocall.rb