Class: Courtier::Configuration::DSL
- Inherits:
-
Object
- Object
- Courtier::Configuration::DSL
- Defined in:
- lib/courtier/configuration.rb
Instance Method Summary collapse
- #config(command, options = {}, &block) ⇒ Object
-
#initialize(configuration) ⇒ DSL
constructor
A new instance of DSL.
- #onload(feature, options = {}, &block) ⇒ Object
-
#profile(name, state = {}, &block) ⇒ Object
Profile block.
Constructor Details
#initialize(configuration) ⇒ DSL
280 281 282 283 |
# File 'lib/courtier/configuration.rb', line 280 def initialize(configuration) @configuration = configuration = {} end |
Instance Method Details
#config(command, options = {}, &block) ⇒ Object
312 313 314 315 316 317 318 |
# File 'lib/courtier/configuration.rb', line 312 def config(command, ={}, &block) nested_keys = .keys & .keys.map{|k| k.to_sym} raise ArgumentError, "nested #{nested_keys.join(', ')}" unless nested_keys.empty? = .merge() @configuration.config(command, , &block) end |
#onload(feature, options = {}, &block) ⇒ Object
322 323 324 325 326 327 328 329 |
# File 'lib/courtier/configuration.rb', line 322 def onload(feature, ={}, &block) nested_keys = .keys & .keys.map{|k| k.to_sym} raise ArgumentError, "nested #{nested_keys.join(', ')}" unless nested_keys.empty? = .merge() [:onload] = true @configuration.config(feature, , &block) end |
#profile(name, state = {}, &block) ⇒ Object
Profile block.
288 289 290 291 292 293 |
# File 'lib/courtier/configuration.rb', line 288 def profile(name, &block) raise SyntaxError, "nested profile sections" if [:profile] [:profile] = name.to_s instance_eval(&block) .delete(:profile) end |