lib/ronin/ui/output/output.rb in ronin-1.0.0 vs lib/ronin/ui/output/output.rb in ronin-1.1.0.rc1
- old
+ new
@@ -15,47 +15,58 @@
#
# You should have received a copy of the GNU General Public License
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
#
+require 'ronin/ui/output/terminal/raw'
require 'ronin/ui/output/terminal/color'
module Ronin
module UI
#
# Controls {Output} from Ronin.
#
module Output
@mode = :quiet
- @handler = Terminal::Color
+ @handler = if STDOUT.tty?
+ Terminal::Color
+ else
+ Terminal::Raw
+ end
#
# @return [Boolean]
# Specifies whether verbose output is enabled.
#
# @since 0.3.0
#
+ # @api semipublic
+ #
def Output.verbose?
@mode == :verbose
end
#
# @return [Boolean]
# Specifies whether quiet output is enabled.
#
# @since 0.3.0
#
+ # @api semipublic
+ #
def Output.quiet?
@mode == :quiet
end
#
# @return [Boolean]
# Specifies whether silent output is enabled.
#
# @since 0.3.0
#
+ # @api semipublic
+ #
def Output.silent?
@mode == :silent
end
#
@@ -63,10 +74,12 @@
#
# @return [Output]
#
# @since 1.0.0
#
+ # @api semipublic
+ #
def Output.verbose!
@mode = :verbose
return self
end
@@ -75,10 +88,12 @@
#
# @return [Output]
#
# @since 1.0.0
#
+ # @api semipublic
+ #
def Output.quiet!
@mode = :quiet
return self
end
@@ -98,10 +113,12 @@
# @return [Ronin::UI::Output::Handler]
# The current Output handler.
#
# @since 0.3.0
#
+ # @api semipublic
+ #
def Output.handler
@handler
end
#
@@ -111,9 +128,11 @@
# The new output handler to use. Must provide the `puts`,
# `print_info`, `print_debug`, `print_warning` and `print_error`
# class methods.
#
# @since 0.3.0
+ #
+ # @api semipublic
#
def Output.handler=(new_handler)
@handler = new_handler
end
end