Class: Mj::AlternativeFile::ThorCommand
- Inherits:
-
Thor
- Object
- Thor
- Mj::AlternativeFile::ThorCommand
- Defined in:
- lib/mj/alternative_file/thor_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.resolvers ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/mj/alternative_file/thor_command.rb', line 56 def self.resolvers @resolvers ||= AlternativeFile::Resolver.new.tap do |resolvers| resolvers.add(Resolvers::Ruby::RailsResolver.new) resolvers.add(Resolvers::Ruby::RailsControllerResolver.new) resolvers.add(Resolvers::Ruby::ViewComponentResolver.new) resolvers.add(Resolvers::Ruby::PackwerkResolver.new) resolvers.add(Resolvers::Ruby::VendoredGemsResolver.new) end end |
Instance Method Details
#list(reference_file) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/mj/alternative_file/thor_command.rb', line 25 def list(reference_file) handler = Commands::ListCommandHandler.new(resolvers: self.class.resolvers) command = Commands::ListCommand.new(reference_file, ) candidates = handler.handle(command) print_candidates(candidates) end |
#next(reference_file) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/mj/alternative_file/thor_command.rb', line 36 def next(reference_file) handler = Commands::ListCommandHandler.new(resolvers: self.class.resolvers) command = Commands::ListCommand.new(reference_file, ) candidates = handler.handle(command) candidate = candidates.after(command.file) print_candidates([candidate].compact) end |
#prev(reference_file) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/mj/alternative_file/thor_command.rb', line 48 def prev(reference_file) handler = Commands::ListCommandHandler.new(resolvers: self.class.resolvers) command = Commands::ListCommand.new(reference_file, ) candidates = handler.handle(command) candidate = candidates.before(command.file) print_candidates([candidate].compact) end |