Class: Courtier::Setup
- Inherits:
-
Object
- Object
- Courtier::Setup
- Defined in:
- lib/courtier/setup.rb
Overview
Tool configuration setup is used to customize how a tool handles configuration.
Instance Attribute Summary collapse
-
#feature ⇒ Object
readonly
Feature for which this is the configuration setup.
Instance Method Summary collapse
- #call(config) ⇒ Object
-
#initialize(feature, options = {}, &block) ⇒ Setup
constructor
Intialize new configuration setup.
- #to_proc ⇒ Object
Constructor Details
#initialize(feature, options = {}, &block) ⇒ Setup
Intialize new configuration setup.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/courtier/setup.rb', line 11 def initialize(feature, ={}, &block) @feature = feature.to_s @command = @feature @command = [:command] || [:tool] if .key?(:command) || .key?(:tool) @profile = [:profile] if .key?(:profile) @block = block end |
Instance Attribute Details
#feature ⇒ Object (readonly)
Feature for which this is the configuration setup.
25 26 27 |
# File 'lib/courtier/setup.rb', line 25 def feature @feature end |
Instance Method Details
#call(config) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/courtier/setup.rb', line 30 def call(config) return unless config.command == @command.to_s if @command return unless config.profile == @profile.to_s if @profile @block.call(config) end |
#to_proc ⇒ Object
40 41 42 |
# File 'lib/courtier/setup.rb', line 40 def to_proc @block end |