Module: Roebe::Base::CommandlineArguments
- Included in:
- Roebe::Base, Shell::Commandline
- Defined in:
- lib/roebe/base/commandline_arguments.rb
Instance Method Summary collapse
-
#append_onto_the_commandline_arguments(i) ⇒ Object
(also: #append_to_the_commandline)
# === append_onto_the_commandline_arguments ========================================================================= #.
-
#clear_commandline_arguments ⇒ Object
# === clear_commandline_arguments ========================================================================= #.
-
#commandline_arguments? ⇒ Boolean
(also: #commandline?, #all_arguments?, #arguments?)
# === commandline_arguments? ========================================================================= #.
-
#commandline_arguments_as_string? ⇒ Boolean
(also: #commandline_arguments_as_string)
# === commandline_arguments_as_string? ========================================================================= #.
-
#commandline_arguments_without_leading_hyphens? ⇒ Boolean
(also: #commandline_arguments_without_leading_hyphens, #non_hyphened_commandline_arguments, #commandline_arguments_without_hyphens?)
# === commandline_arguments_without_leading_hyphens? ========================================================================= #.
-
#first_argument? ⇒ Boolean
(also: #first?, #first_commandline_argument?)
# === first_argument? ========================================================================= #.
-
#first_argument_without_leading_hyphens? ⇒ Boolean
(also: #return_first_non_hyphen_commandline_argument)
# === first_argument_without_leading_hyphens?.
-
#has_an_argument_been_passed? ⇒ Boolean
# === has_an_argument_been_passed? ========================================================================= #.
-
#remove_hyphened_arguments_from_the_commandline_arguments(commandline_arguments = commandline_arguments? ) ⇒ Object
# === remove_hyphened_arguments_from_the_commandline_arguments ========================================================================= #.
-
#return_commandline_arguments_with_leading_hyphens ⇒ Object
(also: #return_hyphenated_commandline_arguments, #return_commandline_arguments_starting_with_hyphens, #hyphened_arguments?, #commandline_arguments_with_leading_hyphens?, #commandline_arguments_with_hyphens?)
# === return_commandline_arguments_with_leading_hyphens ========================================================================= #.
-
#second_argument? ⇒ Boolean
# === second_argument? ========================================================================= #.
-
#set_commandline_arguments(i = ARGV) ⇒ Object
(also: #set_input)
# === set_commandline_arguments ========================================================================= #.
Instance Method Details
#append_onto_the_commandline_arguments(i) ⇒ Object Also known as: append_to_the_commandline
#
append_onto_the_commandline_arguments
#
33 34 35 36 37 |
# File 'lib/roebe/base/commandline_arguments.rb', line 33 def append_onto_the_commandline_arguments(i) @commandline_arguments << i @commandline_arguments.flatten! @commandline_arguments.compact! end |
#clear_commandline_arguments ⇒ Object
#
clear_commandline_arguments
#
64 65 66 |
# File 'lib/roebe/base/commandline_arguments.rb', line 64 def clear_commandline_arguments @commandline_arguments = [] end |
#commandline_arguments? ⇒ Boolean Also known as: commandline?, all_arguments?, arguments?
#
commandline_arguments?
#
24 25 26 |
# File 'lib/roebe/base/commandline_arguments.rb', line 24 def commandline_arguments? @commandline_arguments end |
#commandline_arguments_as_string? ⇒ Boolean Also known as: commandline_arguments_as_string
#
commandline_arguments_as_string?
#
57 58 59 |
# File 'lib/roebe/base/commandline_arguments.rb', line 57 def commandline_arguments_as_string? @commandline_arguments.join(' ').strip end |
#commandline_arguments_without_leading_hyphens? ⇒ Boolean Also known as: commandline_arguments_without_leading_hyphens, non_hyphened_commandline_arguments, commandline_arguments_without_hyphens?
#
commandline_arguments_without_leading_hyphens?
#
101 102 103 104 105 |
# File 'lib/roebe/base/commandline_arguments.rb', line 101 def commandline_arguments_without_leading_hyphens? @commandline_arguments.select {|entry| !entry.start_with? '--' } end |
#first_argument? ⇒ Boolean Also known as: first?, first_commandline_argument?
#
first_argument?
#
42 43 44 |
# File 'lib/roebe/base/commandline_arguments.rb', line 42 def first_argument? @commandline_arguments.first end |
#first_argument_without_leading_hyphens? ⇒ Boolean Also known as: return_first_non_hyphen_commandline_argument
#
first_argument_without_leading_hyphens?
This variant will return the first argument that does NOT have any leading “–”.
#
81 82 83 |
# File 'lib/roebe/base/commandline_arguments.rb', line 81 def first_argument_without_leading_hyphens? commandline_arguments_without_leading_hyphens?.first end |
#has_an_argument_been_passed? ⇒ Boolean
#
has_an_argument_been_passed?
#
71 72 73 |
# File 'lib/roebe/base/commandline_arguments.rb', line 71 def has_an_argument_been_passed? !first_argument?.nil? end |
#remove_hyphened_arguments_from_the_commandline_arguments(commandline_arguments = commandline_arguments? ) ⇒ Object
#
remove_hyphened_arguments_from_the_commandline_arguments
#
112 113 114 115 116 117 118 |
# File 'lib/roebe/base/commandline_arguments.rb', line 112 def remove_hyphened_arguments_from_the_commandline_arguments( commandline_arguments = commandline_arguments? ) commandline_arguments.reject! {|entry| entry.start_with? '--' } end |
#return_commandline_arguments_with_leading_hyphens ⇒ Object Also known as: return_hyphenated_commandline_arguments, return_commandline_arguments_starting_with_hyphens, hyphened_arguments?, commandline_arguments_with_leading_hyphens?, commandline_arguments_with_hyphens?
#
return_commandline_arguments_with_leading_hyphens
#
88 89 90 91 92 |
# File 'lib/roebe/base/commandline_arguments.rb', line 88 def return_commandline_arguments_with_leading_hyphens @commandline_arguments.select {|entry| entry.start_with? '--' } end |
#second_argument? ⇒ Boolean
#
second_argument?
#
50 51 52 |
# File 'lib/roebe/base/commandline_arguments.rb', line 50 def second_argument? @commandline_arguments[1] end |
#set_commandline_arguments(i = ARGV) ⇒ Object Also known as: set_input
#
set_commandline_arguments
#
17 18 19 |
# File 'lib/roebe/base/commandline_arguments.rb', line 17 def set_commandline_arguments(i = ARGV) @commandline_arguments = [i].flatten.compact end |