Sha256: de1989fb6a09a8d957f58a56a1c0ad2269e09d6c764c7cbcc952a950c15230d9

Contents?: true

Size: 355 Bytes

Versions: 13

Compression:

Stored size: 355 Bytes

Contents

class String

  unless method_defined?(:bytes) # 1.8.7+

    # Upacks string into bytes.
    #
    # Note, this is not 100% compatible with 1.8.7+
    # which returns an enumerator instead of an array.
    #
    def bytes(&blk)
      if block_given?
        self.unpack('C*').each(&blk)
      else
        self.unpack('C*')
      end
    end

  end

end

Version data entries

13 entries across 12 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/string/bytes.rb
facets-2.9.2 src/core/facets/string/bytes.rb
facets-2.9.2 lib/core/facets/string/bytes.rb
facets-2.9.1 lib/core/facets/string/bytes.rb
facets-2.9.0 lib/core/facets/string/bytes.rb
facets-2.9.0.pre.2 lib/core/facets/string/bytes.rb
facets-2.9.0.pre.1 lib/core/facets/string/bytes.rb
facets-2.8.4 lib/core/facets/string/bytes.rb
facets-2.8.3 lib/core/facets/string/bytes.rb
facets-2.8.2 lib/core/facets/string/bytes.rb
facets-2.8.1 lib/core/facets/string/bytes.rb
facets-2.8.0 lib/core/facets/string/bytes.rb
facets-2.7.0 lib/core/facets/string/bytes.rb