rasqal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ext/rasqal/extconf.rb +6 -0
  2. data/ext/rasqal/rasqal.c +27 -0
  3. metadata +48 -0
@@ -0,0 +1,6 @@
1
+ require "mkmf"
2
+
3
+ $CFLAGS += " " + `rasqal-config --cflags`
4
+ $LDFLAGS += " " + `rasqal-config --libs`
5
+
6
+ create_makefile "rasqal"
@@ -0,0 +1,27 @@
1
+ #include "ruby.h"
2
+ #include <rasqal.h>
3
+
4
+ rasqal_world *world;
5
+ rasqal_query *query;
6
+
7
+ static VALUE rb_escape_literal(VALUE mod, VALUE str) {
8
+ char *escaped;
9
+ int escaped_length;
10
+ VALUE result;
11
+
12
+ str = StringValue(str);
13
+ escaped = rasqal_query_escape_counted_string(query, RSTRING_PTR(str), RSTRING_LENINT(str), &escaped_length);
14
+ result = rb_str_new(escaped, escaped_length);
15
+ rasqal_free_memory(escaped);
16
+ return result;
17
+ }
18
+
19
+ void Init_rasqal() {
20
+ VALUE Rasqal = rb_define_module("Rasqal");
21
+
22
+ world = rasqal_new_world();
23
+ rasqal_world_open(world);
24
+ query = rasqal_new_query(world, "sparql", NULL);
25
+
26
+ rb_define_module_function(Rasqal, "escape", rb_escape_literal, 1);
27
+ }
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rasqal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Peter Vanbroekhoven
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-03 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Encapsulates the escape function from Rasqal
15
+ email:
16
+ - peter@xaop.com
17
+ executables: []
18
+ extensions:
19
+ - ext/rasqal/extconf.rb
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ext/rasqal/rasqal.c
23
+ - ext/rasqal/extconf.rb
24
+ homepage: ''
25
+ licenses: []
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 1.8.11
45
+ signing_key:
46
+ specification_version: 3
47
+ summary: Encapsulates the escape function from Rasqal
48
+ test_files: []