Class: Bashly::Script::Argument
- Includes:
- Introspection::Validate
- Defined in:
- lib/bashly/script/argument.rb
Instance Attribute Summary
Attributes inherited from Base
Attributes included from Renderable
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Introspection::Validate
Methods inherited from Base
#help, #initialize, #method_missing, #optional, #respond_to_missing?, #summary
Methods included from Renderable
#load_user_file, #render, #strings, #user_file_exist?, #user_file_path, #user_string, #view_marker
Constructor Details
This class inherits a constructor from Bashly::Script::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Bashly::Script::Base
Class Method Details
.option_keys ⇒ Object
9 10 11 12 13 |
# File 'lib/bashly/script/argument.rb', line 9 def option_keys @option_keys ||= i[ allowed default help name repeatable required unique validate ] end |
Instance Method Details
#default_string ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/bashly/script/argument.rb', line 16 def default_string if default.is_a?(Array) Shellwords.shelljoin default elsif default.is_a?(String) && repeatable Shellwords.shellescape default else default end end |
#label ⇒ Object
26 27 28 |
# File 'lib/bashly/script/argument.rb', line 26 def label repeatable ? "#{name.upcase}..." : name.upcase end |
#usage_string ⇒ Object
30 31 32 |
# File 'lib/bashly/script/argument.rb', line 30 def usage_string required ? label : "[#{label}]" end |