lib/ronin/formatting/extensions/text/array.rb in ronin-support-0.5.0 vs lib/ronin/formatting/extensions/text/array.rb in ronin-support-0.5.1

- old
+ new

@@ -38,14 +38,16 @@ # def bytes bytes = [] each do |element| - if element.kind_of?(Integer) - bytes << element + case element + when Integer then bytes << element else - element.to_s.each_byte { |b| bytes << b } + element.to_s.each_byte do |b| + bytes << b + end end end return bytes end @@ -63,12 +65,12 @@ # # @api public # def chars array_bytes = bytes - array_bytes.map! { |b| b.chr } + return array_bytes end # # @return [String] @@ -101,12 +103,12 @@ # # @api public # def hex_chars array_bytes = bytes - array_bytes.map! { |b| '\x%x' % b } + return array_bytes end # # Decodes the bytes contained with the Array, and escapes them as @@ -125,11 +127,11 @@ # # @api public # def hex_integers array_bytes = bytes - array_bytes.map! { |b| '0x%x' % b } + return array_bytes end end