Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added ups_version and Upskirt.version.

  • Loading branch information...
commit 7e6d602756131ccb5d5211a403fcbf5bfe4831f9 1 parent 183912e
Postmodern authored

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. 15  lib/ffi/upskirt/upskirt.rb
15  lib/ffi/upskirt/upskirt.rb
@@ -34,10 +34,25 @@ module Upskirt
34 34
 
35 35
     attach_function :is_safe_link, [:pointer, :size_t], :int
36 36
     attach_function :ups_markdown, [:pointer, :pointer, :pointer, :uint], :void
  37
+    attach_function :ups_version, [:pointer, :pointer, :pointer], :void
37 38
 
38 39
     attach_function :upshtml_renderer, [:pointer, :uint], :void
39 40
     attach_function :upshtml_toc_renderer, [:pointer], :void
40 41
     attach_function :upshtml_free_renderer, [:pointer], :void
41 42
     attach_function :upshtml_smartypants, [:pointer, :pointer], :void
  43
+
  44
+    #
  45
+    # Returns the version of the installed `libupskirt`.
  46
+    #
  47
+    # @return [String]
  48
+    #   The version string.
  49
+    #
  50
+    def Upskirt.version
  51
+      ints = FFI::MemoryPointer.new(:int,3)
  52
+
  53
+      ups_version(ints[0],ints[1],ints[2])
  54
+
  55
+      return ints.get_array_of_int(0,3).join('.')
  56
+    end
42 57
   end
43 58
 end

0 notes on commit 7e6d602

Please sign in to comment.
Something went wrong with that request. Please try again.