lib/ronin/formatting/extensions/text/array.rb in ronin-support-0.1.0 vs lib/ronin/formatting/extensions/text/array.rb in ronin-support-0.2.0.rc1
- old
+ new
@@ -32,10 +32,12 @@
#
# @example
# ['A', 'BB', 0x90].bytes
# # => [0x41, 0x42, 0x42, 0x90]
#
+ # @api public
+ #
def bytes
self.inject([]) do |accum,elem|
if elem.kind_of?(Integer)
accum << elem
else
@@ -55,10 +57,12 @@
#
# @example
# [0x41, 0x41, 0x20].chars
# # => ["A", "A", " "]
#
+ # @api public
+ #
def chars
array_bytes = self.bytes
array_bytes.map! { |b| b.chr }
return array_bytes
@@ -70,10 +74,12 @@
#
# @example
# [0x41, 0x41, 0x20].char_string
# # => "AA "
#
+ # @api public
+ #
def char_string
chars.join
end
#
@@ -89,10 +95,12 @@
#
# @example
# ['A', 'BB', 0x90].bytes
# # => ['\x41', '\x42', '\x42', '\x90']
#
+ # @api public
+ #
def hex_chars
array_bytes = self.bytes
array_bytes.map! { |b| '\x%x' % b }
return array_bytes
@@ -110,9 +118,11 @@
# # => ['0x41', '0x41', '0x20']
#
# @example
# ['A', 'BB', 0x90].bytes
# # => ['0x41', '0x42', '0x42', '0x90']
+ #
+ # @api public
#
def hex_integers
array_bytes = self.bytes
array_bytes.map! { |b| '0x%x' % b }