module CommandLion::Raw

Raw command-line option API

Public Class Methods

arguments() { |argument| ... } click to toggle source
# File lib/command_lion/raw.rb, line 8
def self.arguments
  return @arguments unless block_given?
  @arguments.each do |argument|
    yield argument
  end
end
arguments=(args) click to toggle source
# File lib/command_lion/raw.rb, line 15
def self.arguments=(args)
  @arguments = args
end
arguments?() click to toggle source
# File lib/command_lion/raw.rb, line 19
def self.arguments?
  arguments.size > 0 ? true : false
end
arguments_to(string, flags) { |argument| ... } click to toggle source
# File lib/command_lion/raw.rb, line 31
def self.arguments_to(string, flags)
  return if string.nil?
  return if flags.nil?
  return unless index = index_of(string)
  if block_given?
    arguments.drop(index+1).each do |argument|
      # next if argument == ","
      break if flags.include?(argument)
      yield argument
    end
  else
    args = []
    arguments_to(string, flags) { |arg| args << arg }
    return args
  end
end
arguments_to?(flag) click to toggle source
# File lib/command_lion/raw.rb, line 48
def self.arguments_to?(flag)
  arguments[arguments.index(flag) + 1] ? true : false
end
clear!() click to toggle source
# File lib/command_lion/raw.rb, line 56
def self.clear!
  @arguments = []
end
index_of(flag) click to toggle source
# File lib/command_lion/raw.rb, line 23
def self.index_of(flag)
  arguments.index(flag)
end
index_of?(flag) click to toggle source
# File lib/command_lion/raw.rb, line 27
def self.index_of?(flag)
  index_of(flag) ? true : false
end
possible_argument_to(string) click to toggle source
# File lib/command_lion/raw.rb, line 52
def self.possible_argument_to(string)
  arguments[arguments.index(string) + 1]
end