Sha256: f9cf87ec8793ebd570b5f4dd75595a155d51d82839ecb3e9d1a80cd19c9d2f53

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

module RdiffSimple
  class OptionsParser
    def self.parse(*args)
      options = args.extract_options!

      args.reverse!

      source = args.pop
      destination = args.pop

      flags = args.reverse.map { |flag| flag.size == 1 ? "-#{flag}" : "--#{flag}" } * ' '
      arguments = options.map { |key, value| (key.size == 1 ? "-#{key}" : "--#{key}") + " #{value}" } * ' '

      "#{flags} #{arguments} #{source} #{destination}".dasherize.strip
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rdiff-simple-0.1.0 lib/rdiff_simple/options_parser.rb