Class: Y::Redis::Config::AbstractBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/y/redis/config/abstract_builder.rb

Overview

Abstract base class for Y::Redis and it’s extensions configuration builder. Instantiates and validates gem configuration.

Direct Known Subclasses

Builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = Config.new, &block) ⇒ AbstractBuilder

Returns a new instance of AbstractBuilder.

Parameters:



13
14
15
16
# File 'lib/y/redis/config/abstract_builder.rb', line 13

def initialize(config = Config.new, &block)
  @config = config
  instance_eval(&block)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/y/redis/config/abstract_builder.rb', line 10

def config
  @config
end

Instance Method Details

#buildY::Redis::Config

Builds and validates configuration.

Returns:



21
22
23
24
# File 'lib/y/redis/config/abstract_builder.rb', line 21

def build
  @config.validate! if @config.respond_to?(:validate!)
  @config
end