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.
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
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bitclust/subcommands/ancestors_command.rb', line 48 def exec(argv, ) classname = argv[0] db = MethodDatabase.new(@prefix) ruby = get_ruby(@version) if classname && !@all check_ancestors(db, ruby, @requires, classname) else $stderr.puts 'check all...' check_all_ancestors(db, ruby, @requires) end end |