class Falcon::Command::Top
The top level command for the `falcon` executable.
Public Instance Methods
call()
click to toggle source
Prepare the environment and invoke the sub-command.
# File lib/falcon/command/top.rb, line 93 def call if encoding = self.encoding update_external_encoding!(encoding) else update_external_encoding! end if @options[:version] puts "#{self.name} v#{Falcon::VERSION}" elsif @options[:help] self.print_usage else @command.call end end
encoding()
click to toggle source
The desired external encoding.
# File lib/falcon/command/top.rb, line 86 def encoding if name = @options[:encoding] Encoding.find(name) end end
quiet?()
click to toggle source
Whether quiet logging was enabled. @returns [Boolean]
# File lib/falcon/command/top.rb, line 69 def quiet? @options[:logging] == :quiet end
update_external_encoding!(encoding = Encoding::UTF_8)
click to toggle source
Update the external encoding.
If you don't specify these, it's possible to have issues when encodings mismatch on the server.
@parameter encoding [Encoding] Defaults to `Encoding::UTF_8`.
# File lib/falcon/command/top.rb, line 78 def update_external_encoding!(encoding = Encoding::UTF_8) if Encoding.default_external != encoding Console.logger.warn(self) {"Updating Encoding.default_external from #{Encoding.default_external} to #{encoding}"} Encoding.default_external = encoding end end
verbose?()
click to toggle source
Whether verbose logging is enabled. @returns [Boolean]
# File lib/falcon/command/top.rb, line 63 def verbose? @options[:logging] == :verbose end