Class: Teapot::Command::Top
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Teapot::Command::Top
- Defined in:
- lib/teapot/command.rb
Instance Method Summary collapse
- #controller(root = nil, **options) ⇒ Object
- #invoke(program_name: File.basename($0)) ⇒ Object
- #root ⇒ Object
Instance Method Details
#controller(root = nil, **options) ⇒ Object
160 161 162 |
# File 'lib/teapot/command.rb', line 160 def controller(root = nil, **) Teapot::Controller.new(root || self.root, @options) end |
#invoke(program_name: File.basename($0)) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/teapot/command.rb', line 164 def invoke(program_name: File.basename($0)) if @options[:version] puts "teapot v#{Teapot::VERSION}" elsif @options[:help] or @command.nil? print_usage(program_name) else track_time do @command.invoke(self) end end end |
#root ⇒ Object
156 157 158 |
# File 'lib/teapot/command.rb', line 156 def root @options[:root] || Dir.getwd end |