lib/ronin/ui/output/helpers.rb in ronin-support-0.5.0.rc2 vs lib/ronin/ui/output/helpers.rb in ronin-support-0.5.0
- old
+ new
@@ -69,46 +69,64 @@
end
#
# Prints one or more messages.
#
- # @param [Array] messages
+ # @param [Array] arguments
# The messages to print.
#
# @example
# puts 'some data'
#
# @since 0.3.0
#
# @api public
#
- def puts(*messages)
- unless messages.empty?
- messages.each { |message| write("#{message}#{$/}") }
- else
+ def puts(*arguments)
+ if arguments.empty?
write($/)
+ return nil
end
+ arguments.each do |argument|
+ if argument.kind_of?(Array)
+ argument.each { |element| puts(element) }
+ else
+ str = case argument
+ when nil
+ if RUBY_VERSION > '1.9'
+ ''
+ else
+ 'nil'
+ end
+ else
+ argument.to_s
+ end
+
+ write("#{str}#{$/}")
+ end
+ end
+
return nil
end
#
# Prints formatted data.
#
# @param [String] format
# The format string.
#
- # @param [Array] data
+ # @param [Array] arguments
# The data to format.
#
# @return [nil]
#
# @since 1.0.0
#
# @api public
#
- def printf(format,*data)
- write(format % data)
+ def printf(format,*arguments)
+ write(format % arguments)
return nil
end
#
# Prints an `info` message.