Module: MultimediaParadise::CommandlineArgumentsModule

Included in:
Base
Defined in:
lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb

Overview

MultimediaParadise::CommandlineArgumentsModule

Instance Method Summary collapse

Instance Method Details

#all_input_starts_with_a_number?(i = @commandline_arguments) ⇒ Boolean

#

all_input_starts_with_a_number?

Determine whether the given input starts with a number.

#

Returns:

  • (Boolean)


47
48
49
50
51
52
53
# File 'lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb', line 47

def all_input_starts_with_a_number?(
    i = @commandline_arguments
  )
  !i.empty? and i.all? {|entry|
    entry =~ /^\d+$/
  }
end

#commandline_arguments?Boolean Also known as: input?

#

commandline_arguments?

#

Returns:

  • (Boolean)


24
25
26
# File 'lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb', line 24

def commandline_arguments?
  @commandline_arguments
end

#commandline_arguments_as_a_stringObject Also known as: commandline_arguments_as_string

#

commandline_arguments_as_a_string

#


38
39
40
# File 'lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb', line 38

def commandline_arguments_as_a_string
  @commandline_arguments.join(' ').strip
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)


31
32
33
# File 'lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb', line 31

def first_argument?
  @commandline_arguments.first
end

#first_non_hyphened_commandline_argument?Boolean

#

first_non_hyphened_commandline_argument?

#

Returns:

  • (Boolean)


58
59
60
61
# File 'lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb', line 58

def first_non_hyphened_commandline_argument?
  _ = @commandline_arguments.reject {|entry| entry.start_with?('--') }
  return _.first
end

#set_commandline_arguments(i) ⇒ Object

#

set_commandline_arguments

#


17
18
19
# File 'lib/multimedia_paradise/base/commandline_arguments_module/commandline_arguments_module.rb', line 17

def set_commandline_arguments(i)
  @commandline_arguments = [i].flatten.compact
end