Sha256: e5a56f979e1286aeb2781087f299991d3516bd40c77e4101451e0c8553a5b0e0

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

require 'stringio'
module Ing

  # Classes in this namespace provide a uniform interface to different
  # option parsers.
  #
  module OptionParsers
  
    class Trollop
      
      def parser
        @parser ||= ::Trollop::Parser.new
      end
      
      def parse!(args)
        ::Trollop.with_standard_exception_handling(parser) { parser.parse(args) }
      end
      
      def describe
        s=StringIO.new
        parser.educate_banner s
        s.rewind; s.read      
      end
      
      def help
        s=StringIO.new
        parser.educate s
        s.rewind; s.read      
      end
      
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ing-0.2.7 lib/ing/option_parsers/trollop.rb
ing-0.2.2 lib/ing/option_parsers/trollop.rb
ing-0.2.1 lib/ing/option_parsers/trollop.rb