Parent

FFI::Generator::Application

Constants

OPTIONS
USAGE_PREAMBLE

Public Class Methods

run() click to toggle source
    # File lib/generator/application.rb, line 21
21:         def run      
22:           process_args
23:           if ARGV.size == 2
24:             File.open(ARGV[1], 'w') do |file|
25:               file << FFI::Generator::Parser.new.generate(Nokogiri::XML(File.open(ARGV[0])))
26:             end
27:           else
28:             help
29:             raise "Invalid number of arguments!"
30:           end
31:         end

Private Class Methods

command_line_options() click to toggle source
    # File lib/generator/application.rb, line 43
43:         def command_line_options
44:           OPTIONS.collect { |lst| lst[0..2] }
45:         end
do_option(option, value = nil) click to toggle source
    # File lib/generator/application.rb, line 33
33:         def do_option(option, value = nil)
34:           case option
35:           when '--help'
36:             help
37:             exit
38:           when '--version'
39:             puts "ffi-swig-generator, version #{Generator::VERSION}\n"
40:             exit
41:           end
42:         end
help() click to toggle source
    # File lib/generator/application.rb, line 50
50:         def help
51:           puts
52:           puts USAGE_PREAMBLE
53:           puts "Recognized options are:"
54:           puts
55:           OPTIONS.sort.each do |long, short, mode, desc|
56:             if mode == GetoptLong::REQUIRED_ARGUMENT
57:               if desc =~ /\b([A-Z]{2,})\b/
58:                 long = long + "=#{$1}"
59:               end
60:             end
61:             printf "  %-20s (%s)\n", long, short
62:             printf "      %s\n", desc
63:             puts
64:           end
65:         end
process_args() click to toggle source
    # File lib/generator/application.rb, line 46
46:         def process_args
47:           opts = GetoptLong.new(*command_line_options)
48:           opts.each { |opt, value| do_option(opt, value) }
49:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.