Class: Relish::Command::Config::Option
- Inherits:
-
Object
- Object
- Relish::Command::Config::Option
- Defined in:
- lib/relish/commands/config.rb
Constant Summary collapse
- VALID_OPTIONS =
%w(project)
Instance Method Summary collapse
-
#initialize(param) ⇒ Option
constructor
A new instance of Option.
- #to_hash ⇒ Object
- #validate_option ⇒ Object
Constructor Details
#initialize(param) ⇒ Option
Returns a new instance of Option.
8 9 10 11 |
# File 'lib/relish/commands/config.rb', line 8 def initialize(param) @option, @value = param.split(':') validate_option end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 |
# File 'lib/relish/commands/config.rb', line 20 def to_hash {@option => @value} end |
#validate_option ⇒ Object
13 14 15 16 17 18 |
# File 'lib/relish/commands/config.rb', line 13 def validate_option unless VALID_OPTIONS.include?(@option) Relish::Helpers.error "'#{@option}' is not a valid option." + " Valid options: #{VALID_OPTIONS.join(', ')}" end end |