Class: Pixab::Mbox
- Inherits:
-
Object
- Object
- Pixab::Mbox
- Defined in:
- lib/mbox/Mbox.rb
Instance Attribute Summary collapse
-
#repo_manager ⇒ Object
readonly
Returns the value of attribute repo_manager.
Instance Method Summary collapse
-
#initialize ⇒ Mbox
constructor
A new instance of Mbox.
- #run(commands) ⇒ Object
Constructor Details
#initialize ⇒ Mbox
Returns a new instance of Mbox.
10 11 12 |
# File 'lib/mbox/Mbox.rb', line 10 def initialize @repo_manager = RepoManager.new end |
Instance Attribute Details
#repo_manager ⇒ Object (readonly)
Returns the value of attribute repo_manager.
8 9 10 |
# File 'lib/mbox/Mbox.rb', line 8 def repo_manager @repo_manager end |
Instance Method Details
#run(commands) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mbox/Mbox.rb', line 14 def run(commands) if commands.empty? puts "请输入命令".red return end command = commands[0] case command when "add" MboxAdd.new(repo_manager).run(commands[1..-1]) when "remove" MboxRemove.new(repo_manager).run(commands[1..-1]) else `mbox #{commands.join(" ")}` end end |