From 794d843b4589c79cf41516c6d4392e74a63d5835 Mon Sep 17 00:00:00 2001 From: Postmodern Date: Wed, 11 May 2011 19:55:59 -0700 Subject: [PATCH] Added Buffer#to_smartypants. --- lib/ffi/upskirt/buffer.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/ffi/upskirt/buffer.rb b/lib/ffi/upskirt/buffer.rb index dec7e03..c991c98 100644 --- a/lib/ffi/upskirt/buffer.rb +++ b/lib/ffi/upskirt/buffer.rb @@ -1,4 +1,4 @@ -require 'ffi' +require 'ffi/upskirt/upskirt' module FFI module Upskirt @@ -10,6 +10,16 @@ class Buffer < FFI::Struct :unit, :size_t, :ref, :int + def to_smartypants + smart_buffer = Upskirt.bufnew(128) + + Upskirt.upshtml_smartypants(smart_buffer,self) + result = smart_buffer.data.get_string(0,smart_buffer.size) + + smart_buffer.free + return result + end + end end end