Module: GamesAndRpgParadise::Base::Extensions::CommandlineArguments

Included in:
GamesAndRpgParadise::Base::Extensions, DnD::Combat, GUI::Tk::Gamebook
Defined in:
lib/games_and_rpg_paradise/base/extensions/commandline_arguments.rb

Overview

GamesAndRpgParadise::Base::Extensions::CommandlineArguments

Instance Method Summary collapse

Instance Method Details

#commandline_arguments?Boolean Also known as: input?

#

commandline_arguments?

#

Returns:

  • (Boolean)


36
37
38
# File 'lib/games_and_rpg_paradise/base/extensions/commandline_arguments.rb', line 36

def commandline_arguments?
  @commandline_arguments
end

#filter_away_commandline_arguments(i = commandline_arguments? ) ⇒ Object

#

filter_away_commandline_arguments

#


43
44
45
46
47
# File 'lib/games_and_rpg_paradise/base/extensions/commandline_arguments.rb', line 43

def filter_away_commandline_arguments(
    i = commandline_arguments?
  )
  return i.reject {|entry| entry.start_with? '--' }
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)


29
30
31
# File 'lib/games_and_rpg_paradise/base/extensions/commandline_arguments.rb', line 29

def first_argument?
  @commandline_arguments.first
end

#first_non_hyphened_argument?Boolean

#

first_non_hyphened_argument?

#

Returns:

  • (Boolean)


52
53
54
55
# File 'lib/games_and_rpg_paradise/base/extensions/commandline_arguments.rb', line 52

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

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


21
22
23
24
# File 'lib/games_and_rpg_paradise/base/extensions/commandline_arguments.rb', line 21

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