1.5.0 (latest) 1.4.1 1.3.0 1.2.0 1.1.0 1.0.1 0.26.0 0.25.0 0.24.0 Reference documentation and code samples for the gapic-common module Gapic::Config.

Config is a simple DSL for creating Configuration classes.

## Included In

- [Gapic::Config::Method](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-Config-Method)

## Example

```ruby
require "gapic/config"

class SampleConfig
  extend Gapic::Config

  config_attr :name,   nil,         String, nil
  config_attr :active, true,        true, false
  config_attr :count,  nil,         Numeric, nil
  config_attr :env,    :production, String, Symbol

  def initialize parent_config = nil
    @parent_config = parent_config unless parent_config.nil?
    yield self if block_given?
  end
end

config = SampleConfig.new

config.name             #=> nil
config.name = "thor"    #=> "thor"
config.name             #=> "thor"
config.name = :thor     # ArgumentError
```

## Methods

### #config_attr

    def config_attr(name, default, *valid_values, &validator)

Add configuration attribute methods to the configuratin class.
**Parameters**

- **name** (String, Symbol) --- The name of the option
- **default** (Object, nil) --- Initial value (nil is allowed)
- **valid_values** (Array) --- A list of valid types
**Raises**

- (NameError)