hallo_welt 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/hallo_welt +7 -1
- data/bin/trigger_error +22 -0
- data/ext/hallo_welt/hallo_welt.c +18 -4
- data/lib/hallo_welt/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fe23179f2cfc5d6c7bf041c264f10d7f9407bb1
|
4
|
+
data.tar.gz: e2003c1fea3b9179bd2446f7cfd9491b01448b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b4df49dfe3dc7caf6a0d93ec940a830efc3a9058c77679c9011390f9398909f46f0d460efb15c64a2576ecf661c6dfa1b1aaa8dd82e7fa5849594c5e6e82d01
|
7
|
+
data.tar.gz: bbcfec99bd00bb279c264bfc89da1c756c7fc036bbba44c1921227dd114f185975ed0f895fd20f598beaf9515caa9d1b047b5ca1c5e64ffaae76b82957d8f91e
|
data/bin/hallo_welt
CHANGED
data/bin/trigger_error
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'hallo_welt'
|
4
|
+
|
5
|
+
hw = HalloWelt.new
|
6
|
+
|
7
|
+
puts "#version (#{HalloWelt::VERSION})"
|
8
|
+
|
9
|
+
# say hello
|
10
|
+
hw.hello
|
11
|
+
|
12
|
+
# say what I want
|
13
|
+
hw.print('what I want')
|
14
|
+
|
15
|
+
class TriggerError
|
16
|
+
def self.to_s
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#trigger error
|
22
|
+
hw.print(TriggerError)
|
data/ext/hallo_welt/hallo_welt.c
CHANGED
@@ -1,13 +1,27 @@
|
|
1
1
|
#include <ruby.h>
|
2
2
|
|
3
3
|
static VALUE hallo_welt_hello(VALUE self) {
|
4
|
-
printf("
|
4
|
+
printf("Hello World!");
|
5
|
+
return Qnil;
|
6
|
+
}
|
7
|
+
|
8
|
+
static VALUE hallo_welt_print(VALUE self, VALUE obj) {
|
9
|
+
VALUE printable = rb_funcall(obj, rb_intern("to_s"), 0);
|
10
|
+
switch (TYPE(printable)) {
|
11
|
+
case T_STRING:
|
12
|
+
printf("%s\n", RSTRING_PTR(printable));
|
13
|
+
break;
|
14
|
+
default:
|
15
|
+
rb_raise(rb_eTypeError, "Could not obtain a valid String!");
|
16
|
+
break;
|
17
|
+
}
|
5
18
|
return Qnil;
|
6
19
|
}
|
7
20
|
|
8
21
|
void Init_hallo_welt(void) {
|
9
|
-
VALUE
|
22
|
+
VALUE cHalloWelt;
|
10
23
|
|
11
|
-
|
12
|
-
rb_define_method(
|
24
|
+
cHalloWelt = rb_const_get(rb_cObject, rb_intern("HalloWelt"));
|
25
|
+
rb_define_method(cHalloWelt, "hello", hallo_welt_hello, 0);
|
26
|
+
rb_define_method(cHalloWelt, "print", hallo_welt_print, 1);
|
13
27
|
}
|
data/lib/hallo_welt/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallo_welt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Fast
|
@@ -57,6 +57,7 @@ email:
|
|
57
57
|
- andreas.fast@moove-it.com
|
58
58
|
executables:
|
59
59
|
- hallo_welt
|
60
|
+
- trigger_error
|
60
61
|
extensions:
|
61
62
|
- ext/hallo_welt/extconf.rb
|
62
63
|
extra_rdoc_files: []
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- README.md
|
68
69
|
- Rakefile
|
69
70
|
- bin/hallo_welt
|
71
|
+
- bin/trigger_error
|
70
72
|
- ext/hallo_welt/extconf.rb
|
71
73
|
- ext/hallo_welt/hallo_welt.c
|
72
74
|
- hallo_welt.gemspec
|