Class: BitClust::Subcommands::AncestorsCommand
- Inherits:
-
BitClust::Subcommand
- Object
- BitClust::Subcommand
- BitClust::Subcommands::AncestorsCommand
- Includes:
- CrossRubyUtils
- Defined in:
- lib/bitclust/subcommands/ancestors_command.rb
Instance Method Summary collapse
- #exec(argv, options) ⇒ Object
-
#initialize ⇒ AncestorsCommand
constructor
A new instance of AncestorsCommand.
-
#needs_database? ⇒ Boolean
DB はサブコマンド自身の -d/--database オプションで受ける.
Methods inherited from BitClust::Subcommand
#align_progress_bar_title, #error, #help, #option_error, #parse, #srcdir_root
Constructor Details
#initialize ⇒ AncestorsCommand
Returns a new instance of AncestorsCommand.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bitclust/subcommands/ancestors_command.rb', line 14 def initialize super @prefix = nil @requires = [] @version = RUBY_VERSION @all = false @verbose = false @parser. = <<-BANNER Usage: #{File.basename($0, '.*')} ancestors [-r<lib>] [--ruby=<VER>] --db=PATH <classname> #{File.basename($0, '.*')} ancestors [-r<lib>] [--ruby=<VER>] --db=PATH --all NG Sample: $ #{File.basename($0, '.*')} ancestors -rfoo --ruby=1.9.1 --db=./db Foo NG : Foo + FooModule (The Ruby have this class/module in ancestors of the class) - BarModule (The Database have this class/module in ancestors of the class) Options: BANNER @parser.on('-d', '--database=PATH', 'Database prefix.') {|path| @prefix = path } @parser.on('-r LIB', 'Requires library LIB') {|lib| @requires.push lib } @parser.on('--ruby=[VER]', "The version of Ruby interpreter"){|ver| @version = ver } @parser.on('-v', '--verbose', 'Show differences'){ @verbose = true } @parser.on('--all', 'Check anccestors for all classes'){ @all = true } end |
Instance Method Details
#exec(argv, options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bitclust/subcommands/ancestors_command.rb', line 53 def exec(argv, ) classname = argv[0] db = MethodDatabase.new(@prefix || raise) ruby = get_ruby(@version) || raise if classname && !@all check_ancestors(db, ruby, @requires, classname) else $stderr.puts 'check all...' check_all_ancestors(db, ruby, @requires) end end |
#needs_database? ⇒ Boolean
DB はサブコマンド自身の -d/--database オプションで受ける
49 50 51 |
# File 'lib/bitclust/subcommands/ancestors_command.rb', line 49 def needs_database? false end |