Method: Columnize.parse_columnize_options
- Defined in:
- lib/columnize/opts.rb
.parse_columnize_options(args) ⇒ Object
Options parsing routine for Columnize::columnize. In the preferred newer style, args is a hash where each key is one of the option names.
In the older style positional arguments are used and the positions are in the order: displaywidth, colsep, arrange_vertical, ljust, and line_prefix.
26 27 28 29 30 31 32 33 34 |
# File 'lib/columnize/opts.rb', line 26 def self.(args) if 1 == args.size && args[0].kind_of?(Hash) # explicitly passed as a hash args[0] elsif !args.empty? # passed as ugly positional parameters. Hash[args.zip([:displaywidth, :colsep, :arrange_vertical, :ljust, :line_prefix]).map(&:reverse)] else {} end end |