Class: Gapic::Config::Method

Inherits:
Object
  • Object
show all
Extended by:
Gapic::Config
Defined in:
lib/gapic/config/method.rb

Overview

Config::Method is a configuration class that represents the configuration for an API RPC call.

Examples:

require "gapic/config"

class ServiceConfig
  extend Gapic::Config

  config_attr :host,     "localhost", String
  config_attr :port,     443,         Integer
  config_attr :timeout,  nil,         Numeric, nil
  config_attr :metadata, nil,         Hash, nil

  attr_reader :rpc_method

  def initialize parent_config = nil
    @parent_config = parent_config unless parent_config.nil?
    @rpc_method = Gapic::Config::Method.new

    yield self if block_given?
  end
end

config = ServiceConfig.new

config.timeout = 60
config.rpc_method.timeout = 120

Instance Method Summary collapse

Methods included from Gapic::Config

config_attr

Constructor Details

#initialize(parent_method = nil) {|_self| ... } ⇒ Method

Create a new Config::Method object instance.

Parameters:

Yields:

  • (_self)

Yield Parameters:



58
59
60
61
62
# File 'lib/gapic/config/method.rb', line 58

def initialize parent_method = nil
  @parent_config = parent_method unless parent_method.nil?

  yield self if block_given?
end