Class: Zae::Commands
- Inherits:
-
Object
- Object
- Zae::Commands
- Defined in:
- lib/zae/commands.rb
Overview
All Commands available
Constant Summary collapse
- ACTIONS =
i[clean build depends download info install installed remove search update upgrade].freeze
Class Method Summary collapse
-
.create_commands ⇒ Object
generate dynamically methods of every command.
- .exec ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Commands
constructor
A new instance of Commands.
Constructor Details
#initialize ⇒ Commands
Returns a new instance of Commands.
19 20 21 |
# File 'lib/zae/commands.rb', line 19 def initialize Commands.create_commands end |
Class Method Details
.create_commands ⇒ Object
generate dynamically methods of every command
26 27 28 29 30 31 32 |
# File 'lib/zae/commands.rb', line 26 def self.create_commands ACTIONS.each do |name| define_method name do |arguments = []| Commands.exec name, arguments end end end |
.exec ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/zae/commands.rb', line 34 def self.exec(...) Translate.new(...) .to_s .then(&lambda { |command| puts "❯: #{command}" system command }) end |