Permalink
Browse files

Added ups_version and Upskirt.version.

  • Loading branch information...
1 parent 183912e commit 7e6d602756131ccb5d5211a403fcbf5bfe4831f9 @postmodern committed May 12, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/ffi/upskirt/upskirt.rb
View
15 lib/ffi/upskirt/upskirt.rb
@@ -34,10 +34,25 @@ module Upskirt
attach_function :is_safe_link, [:pointer, :size_t], :int
attach_function :ups_markdown, [:pointer, :pointer, :pointer, :uint], :void
+ attach_function :ups_version, [:pointer, :pointer, :pointer], :void
attach_function :upshtml_renderer, [:pointer, :uint], :void
attach_function :upshtml_toc_renderer, [:pointer], :void
attach_function :upshtml_free_renderer, [:pointer], :void
attach_function :upshtml_smartypants, [:pointer, :pointer], :void
+
+ #
+ # Returns the version of the installed `libupskirt`.
+ #
+ # @return [String]
+ # The version string.
+ #
+ def Upskirt.version
+ ints = FFI::MemoryPointer.new(:int,3)
+
+ ups_version(ints[0],ints[1],ints[2])
+
+ return ints.get_array_of_int(0,3).join('.')
+ end
end
end

0 comments on commit 7e6d602

Please sign in to comment.