Class: Cliqr::Config::Shell Private
- Inherits:
-
OptionBased
- Object
- Base
- EventBased
- Named
- OptionBased
- Cliqr::Config::Shell
- Defined in:
- lib/cliqr/config/shell.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Config attributes for shell
Instance Attribute Summary collapse
-
#banner ⇒ String
private
Banner that is displayed when shell starts.
-
#enabled ⇒ Symbol
private
Enable or disable the shell action.
-
#prompt ⇒ String, Proc
private
Prompt for the shell.
Attributes inherited from OptionBased
Attributes inherited from Named
Attributes inherited from EventBased
Instance Method Summary collapse
-
#disable_color ⇒ Cliqr::Command::Color
private
Disable colors in shell.
-
#enabled? ⇒ Boolean
private
Check if shell is enabled.
-
#finalize ⇒ Cliqr::Config::Option
private
Finalize shell’s config by adding default values for unset values.
-
#initialize ⇒ Shell
constructor
private
Initialize a new config instance for an option with UNSET attribute values.
Methods inherited from OptionBased
#option, #option?, #options?, #set_config
Methods inherited from Named
Methods inherited from EventBased
Methods inherited from Base
#set_config, #skip_validation?
Methods included from Validation
#errors, included, #read_attributes, #valid?, #validate, #validations
Methods included from DSL
Constructor Details
#initialize ⇒ Shell
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new config instance for an option with UNSET attribute values
43 44 45 46 47 48 49 |
# File 'lib/cliqr/config/shell.rb', line 43 def initialize super @enabled = UNSET @prompt = UNSET @banner = UNSET end |
Instance Attribute Details
#banner ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Banner that is displayed when shell starts
34 35 36 |
# File 'lib/cliqr/config/shell.rb', line 34 def @banner end |
#enabled ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Enable or disable the shell action
15 16 17 |
# File 'lib/cliqr/config/shell.rb', line 15 def enabled @enabled end |
#prompt ⇒ String, Proc
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prompt for the shell
23 24 25 |
# File 'lib/cliqr/config/shell.rb', line 23 def prompt @prompt end |
Instance Method Details
#disable_color ⇒ Cliqr::Command::Color
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Disable colors in shell
82 83 84 |
# File 'lib/cliqr/config/shell.rb', line 82 def disable_color @prompt.disable_color if @prompt.respond_to?(:disable_color) end |
#enabled? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if shell is enabled
75 76 77 |
# File 'lib/cliqr/config/shell.rb', line 75 def enabled? @enabled end |
#finalize ⇒ Cliqr::Config::Option
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Finalize shell’s config by adding default values for unset values
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/cliqr/config/shell.rb', line 54 def finalize super case @enabled when Cliqr::Config::ENABLE_CONFIG @enabled = true when Cliqr::Config::DISABLE_CONFIG @enabled = false when UNSET @enabled = true end @prompt = Config.get_if_unset(@prompt, Cliqr::Command::ShellPromptBuilder.new) @banner = Config.get_if_unset(@banner, Cliqr::Command::ShellBannerBuilder.new) # set default name for the shell action @name = 'shell' if @name.is_a?(String) && @name.empty? self end |