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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f829fd0c204245b845523f3526611301997c35d3
4
- data.tar.gz: 29ef1ef017bb3360d9cb0130dea992d6fd8e1d8c
3
+ metadata.gz: 9fe23179f2cfc5d6c7bf041c264f10d7f9407bb1
4
+ data.tar.gz: e2003c1fea3b9179bd2446f7cfd9491b01448b7b
5
5
  SHA512:
6
- metadata.gz: f67987dac4e26dcf1a12077d6d1897d3842afaaafcd958ad80af6f91eb8a4ce56d321ebe708965d16537ad7ea7f73379f837164e9dfb25b5d420f50a0eca4cf3
7
- data.tar.gz: c30bcdc039e1145435988e340efd9337d16885d67f0506e200d32ae4c5e68b77467fb40ff78751714ab08e99060c723c95a3eceab4c0e7b8435351799613bf3b
6
+ metadata.gz: 1b4df49dfe3dc7caf6a0d93ec940a830efc3a9058c77679c9011390f9398909f46f0d460efb15c64a2576ecf661c6dfa1b1aaa8dd82e7fa5849594c5e6e82d01
7
+ data.tar.gz: bbcfec99bd00bb279c264bfc89da1c756c7fc036bbba44c1921227dd114f185975ed0f895fd20f598beaf9515caa9d1b047b5ca1c5e64ffaae76b82957d8f91e
data/bin/hallo_welt CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  require 'hallo_welt'
4
4
 
5
+ hw = HalloWelt.new
6
+
5
7
  puts "#version (#{HalloWelt::VERSION})"
6
8
 
7
- HalloWelt.new.hello
9
+ # say hello
10
+ hw.hello
11
+
12
+ # say what I want
13
+ hw.print('what I want')
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)
@@ -1,13 +1,27 @@
1
1
  #include <ruby.h>
2
2
 
3
3
  static VALUE hallo_welt_hello(VALUE self) {
4
- printf("Hallo Welt!");
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 cHelloWorld;
22
+ VALUE cHalloWelt;
10
23
 
11
- cHelloWorld = rb_const_get(rb_cObject, rb_intern("HalloWelt"));
12
- rb_define_method(cHelloWorld, "hello", hallo_welt_hello, 0);
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
  }
@@ -1,3 +1,3 @@
1
1
  class HalloWelt
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
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.1
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