Skip to content

Instantly share code, notes, and snippets.

@zzak
Last active December 15, 2015 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zzak/5259615 to your computer and use it in GitHub Desktop.
Save zzak/5259615 to your computer and use it in GitHub Desktop.
require 'rdoc'
class RDoc::Options
attr_accessor :you
attr_accessor :me
end
class MyGen
attr_reader :options
attr_reader :store
def self.setup_options(options)
RDoc::RDoc.add_generator self
options.you = "you"
options.me = "me"
opt = options.option_parser
opt.separator nil
opt.separator "MyGen generator options:"
opt.separator nil
opt.on("--you", "-y", "Set your name", String) do |value|
options.you = value
end
opt.separator nil
opt.on("--me", "-m", "Set my name", String) do |value|
options.me = value
end
opt.separator nil
puts options.me
puts options.you
end
def initialize(store, options)
@store = store
@options = options
end
end
#RDoc::RDoc::GENERATORS['mygen'] = MyGen
#options = RDoc::Options.new
#options.setup_generator 'mygen'
#ARGV.push('--format=mygen') if ARGV.grep(/\A(-f|--fmt|--format|-r|-R|--ri|--ri-site)\b/).empty?
RDoc::RDoc.new.document ARGV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment