Class: RC::Setup
- Inherits:
-
Object
- Object
- RC::Setup
- Defined in:
- lib/rc/setup.rb
Overview
Configuration setup is used to customize how a tool handles configuration.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Command for which this is the configuration setup.
-
#profile ⇒ Object
readonly
Specific profile for which this is the configuration is the setup.
Instance Method Summary collapse
- #call(config) ⇒ Object
-
#initialize(command, options = {}, &block) ⇒ Setup
constructor
Intialize new configuration setup.
- #to_proc ⇒ Object
Constructor Details
#initialize(command, options = {}, &block) ⇒ Setup
Intialize new configuration setup.
12 13 14 15 16 17 18 19 |
# File 'lib/rc/setup.rb', line 12 def initialize(command, ={}, &block) @command = command.to_s #@command = options[:command] || options[:tool] if options.key?(:command) || options.key?(:tool) @profile = [:profile] if .key?(:profile) @block = block end |
Instance Attribute Details
#command ⇒ Object (readonly)
Command for which this is the configuration setup.
24 25 26 |
# File 'lib/rc/setup.rb', line 24 def command @command end |
#profile ⇒ Object (readonly)
Specific profile for which this is the configuration is the setup.
29 30 31 |
# File 'lib/rc/setup.rb', line 29 def profile @profile end |
Instance Method Details
#call(config) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rc/setup.rb', line 34 def call(config) return unless config.command == @command #.to_s if @command case profile when true return unless RC.profile? when nil, false else return unless config.profile == @profile.to_s #if @profile end @block.call(config) end |
#to_proc ⇒ Object
51 52 53 |
# File 'lib/rc/setup.rb', line 51 def to_proc @block end |