Class: Moltrio::Config::Builder
- Inherits:
-
Object
- Object
- Moltrio::Config::Builder
- Defined in:
- lib/moltrio/config/builder.rb
Instance Attribute Summary collapse
-
#chains ⇒ Object
readonly
Returns the value of attribute chains.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #chain(name, &block) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #redis(callable) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
14 15 16 17 |
# File 'lib/moltrio/config/builder.rb', line 14 def initialize @chains = Hamster.hash @config = Hamster.hash end |
Instance Attribute Details
#chains ⇒ Object (readonly)
Returns the value of attribute chains.
13 14 15 |
# File 'lib/moltrio/config/builder.rb', line 13 def chains @chains end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/moltrio/config/builder.rb', line 13 def config @config end |
Class Method Details
.run(&block) ⇒ Object
7 8 9 10 11 |
# File 'lib/moltrio/config/builder.rb', line 7 def self.run(&block) builder = new builder.instance_exec(&block) builder end |
Instance Method Details
#chain(name, &block) ⇒ Object
19 20 21 22 |
# File 'lib/moltrio/config/builder.rb', line 19 def chain(name, &block) chain = ChainBuilder.run(@config, &block) @chains = @chains.put(name, chain) end |
#redis(callable) ⇒ Object
24 25 26 |
# File 'lib/moltrio/config/builder.rb', line 24 def redis(callable) @config = @config.put(:redis, callable.to_proc) end |