Method: Rex::Parser::Arguments#initialize

Defined in:
lib/rex/parser/arguments.rb

#initialize(fmt) ⇒ Arguments

Initializes the format list with an array of formats like:

Arguments.new(

'-b' => [ false, "some text" ]

)



28
29
30
31
32
33
34
35
# File 'lib/rex/parser/arguments.rb', line 28

def initialize(fmt)
  self.fmt = fmt
  # I think reduce is a better name for this method, but it doesn't exist
  # before 1.8.7, so use the stupid inject instead.
  self.longest = fmt.keys.inject(0) { |max, str|
    max = ((max > str.length) ? max : str.length)
  }
end