Sha256: cfb48fdb40e18efe06a7ea3e2dc0a6bd9583786ebe26c26f5fa3a8c443533ddf

Contents?: true

Size: 586 Bytes

Versions: 6

Compression:

Stored size: 586 Bytes

Contents

module CommandLion

  module Raw

    def self.index_of(string)
      ARGV.index(string)
    end

    def self.arguments_to(string, flags)
      return unless index_of(string)
      args = []
      ARGV.drop(index_of(string)+1).each do |argument|
        next if argument == ","
        break if flags.include?(argument)
        args << argument
        yield argument if block_given?
      end
      args
    end

    def self.arguments_to?(string)
      ARGV[ARGV.index(string) + 1]
    end
    
    def self.argument_to(string)
      ARGV[ARGV.index(string) + 1]
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
command_lion-1.0.4 lib/command_lion/raw.rb
command_lion-1.0.3geff lib/command_lion/raw.rb
command_lion-1.0.3 lib/command_lion/raw.rb
command_lion-1.0.2 lib/command_lion/raw.rb
command_lion-1.0.1 lib/command_lion/raw.rb
command_lion-1.0.0 lib/command_lion/raw.rb