Sha256: 06ab6fd8e443c767257e66b715353c0d7834d01773aeb6944526d59f6e76fe7e

Contents?: true

Size: 580 Bytes

Versions: 1

Compression:

Stored size: 580 Bytes

Contents

# Buffer structure.
#
class Tidybuf

  extend DL::Importable
  
  # Access TidyBuffer instance.
  #
  attr_reader(:struct)

  # Mimic TidyBuffer.
  #
  TidyBuffer = struct [
    "byte* bp",
    "uint size",
    "uint allocated",
    "uint next"
  ]

  def initialize
    @struct = TidyBuffer.malloc
  end
    
  # Free current contents and zero out.
  #
  def free
    Tidylib.buf_free(@struct)
  end

  # Convert to array.
  #
  def to_a
    to_s.split("\r\n")
  end

  # Convert to string.
  #
  def to_s
    @struct.bp.to_s
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tidy-1.1.0 lib/tidy/tidybuf.rb