real_include 0.1.3-i386-mingw32 → 0.1.5-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -25,11 +25,11 @@ specification = Gem::Specification.new do |s|
25
25
  s.homepage = "http://banisterfiend.wordpress.com"
26
26
  s.has_rdoc = false
27
27
 
28
- # s.extensions = ["ext/real_include/extconf.rb"]
28
+ #s.extensions = ["ext/real_include/extconf.rb"]
29
29
  s.files = ["Rakefile", "README.markdown", "CHANGELOG",
30
- "lib/real_include.rb", "lib/real_include/version.rb", "lib/1.9/real_include.so",
31
- "lib/1.8/real_include.so"] +
32
- FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c"].to_a
30
+ "lib/real_include.rb", "lib/real_include/version.rb"] +
31
+ ["lib/1.9/real_include.so", "lib/1.8/real_include.so"] +
32
+ FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/**/*.rb"].to_a
33
33
  end
34
34
 
35
35
  Rake::GemPackageTask.new(specification) do |package|
@@ -11,11 +11,12 @@
11
11
  # define RCLASS_SUPER(c) (RCLASS(c)->super)
12
12
  # define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
13
13
  # define OBJ_UNTRUSTED OBJ_TAINTED
14
- # define FALSE 0
15
- # define TRUE 1
16
14
  # include "st.h"
17
15
  #endif
18
16
 
17
+ # define FALSE 0
18
+ # define TRUE 1
19
+
19
20
  /* a useful macro. cannot use ordinary CLASS_OF as it does not return an lvalue */
20
21
  #define KLASS_OF(c) (RBASIC(c)->klass)
21
22
 
@@ -31,7 +31,7 @@ include_class_new(VALUE module, VALUE super)
31
31
  VALUE klass = class_alloc(T_ICLASS, rb_singleton_class(rb_cModule));
32
32
  #else
33
33
  NEWOBJ(klass, struct RClass);
34
- OBJSETUP(klass, rb_cClass, T_ICLASS);
34
+ OBJSETUP(klass, rb_singleton_class(rb_cModule), T_ICLASS);
35
35
  #endif
36
36
  /* we want a fresh ivtbl */
37
37
  RCLASS_IV_TBL(klass) = st_init_numtable();
Binary file
@@ -1,3 +1,3 @@
1
1
  module RealInclude
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.5"
3
3
  end
data/test/test.rb ADDED
@@ -0,0 +1,77 @@
1
+ require 'rubygems'
2
+ require '../lib/real_include'
3
+ require 'bacon'
4
+
5
+ describe 'Including a module into a class using real_include' do
6
+ before do
7
+ @m = Module.new {
8
+ def self.class_method
9
+ :class_method
10
+ end
11
+
12
+ def instance_method
13
+ :instance_method
14
+ end
15
+ }
16
+
17
+ @c = Class.new
18
+
19
+ @c.send(:real_include, @m)
20
+ end
21
+
22
+ it 'should make class methods accessible to class' do
23
+ @c.class_method.should.equal :class_method
24
+ end
25
+
26
+ it 'should make instance methods accessible to instances of the class' do
27
+ obj = @c.new
28
+ obj.instance_method.should.equal :instance_method
29
+ end
30
+ end
31
+
32
+
33
+ describe 'Including a module into a module and then into a class using real_include' do
34
+ before do
35
+ @m1 = Module.new {
36
+ def self.class_method1
37
+ :class_method1
38
+ end
39
+
40
+ def instance_method1
41
+ :instance_method1
42
+ end
43
+ }
44
+
45
+ @m2 = Module.new {
46
+ def self.class_method2
47
+ :class_method2
48
+ end
49
+
50
+ def instance_method2
51
+ :instance_method2
52
+ end
53
+ }
54
+
55
+ @m2.send(:real_include, @m1)
56
+
57
+ @c = Class.new
58
+
59
+ @c.send(:real_include, @m2)
60
+ end
61
+
62
+ it 'should make class methods on m1 accessible to m2' do
63
+ @m2.class_method1.should.equal :class_method1
64
+ end
65
+
66
+ it 'should make class methods on modules m1 and m2 accessible to class' do
67
+ @c.class_method1.should.equal :class_method1
68
+ @c.class_method2.should.equal :class_method2
69
+ end
70
+
71
+ it 'should make instance methods on modules m1 and m2 accessible to instances of class' do
72
+ obj = @c.new
73
+
74
+ obj.instance_method1.should.equal :instance_method1
75
+ obj.instance_method2.should.equal :instance_method2
76
+ end
77
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real_include
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 3
9
- version: 0.1.3
9
+ - 5
10
+ version: 0.1.5
10
11
  platform: i386-mingw32
11
12
  authors:
12
13
  - John Mair (banisterfiend)
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-05 00:00:00 +13:00
18
+ date: 2010-10-09 00:00:00 +13:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -37,6 +38,7 @@ files:
37
38
  - ext/real_include/extconf.rb
38
39
  - ext/real_include/compat.h
39
40
  - ext/real_include/real_include.c
41
+ - test/test.rb
40
42
  has_rdoc: false
41
43
  homepage: http://banisterfiend.wordpress.com
42
44
  licenses: []
@@ -51,6 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
53
  requirements:
52
54
  - - ">="
53
55
  - !ruby/object:Gem::Version
56
+ hash: 3
54
57
  segments:
55
58
  - 0
56
59
  version: "0"
@@ -59,6 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
62
  requirements:
60
63
  - - ">="
61
64
  - !ruby/object:Gem::Version
65
+ hash: 3
62
66
  segments:
63
67
  - 0
64
68
  version: "0"