Last active
December 15, 2015 12:19
-
-
Save zzak/5259615 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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