mult 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +26 -24
- data/lib/mult/version.rb +3 -0
- data/lib/mult.rb +4 -1
- metadata +11 -7
- data/ext/mult/compat.h +0 -27
- data/ext/mult/mult.c +0 -79
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
direc = File.dirname(__FILE__)
|
2
|
+
|
1
3
|
require 'rake/clean'
|
2
|
-
require 'rake/extensiontask'
|
3
4
|
require 'rake/gempackagetask'
|
4
5
|
require 'rake/rdoctask'
|
5
|
-
|
6
|
-
MULT_VERSION = "0.1.2"
|
6
|
+
require "#{direc}/lib/mult/version"
|
7
7
|
|
8
8
|
dlext = Config::CONFIG['DLEXT']
|
9
9
|
|
@@ -11,32 +11,34 @@ CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext
|
|
11
11
|
CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
|
12
12
|
|
13
13
|
spec = Gem::Specification.new do |s|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
s.name = "mult"
|
15
|
+
s.summary = "a few handy extensions to mess with ruby objects"
|
16
|
+
s.description = s.summary
|
17
|
+
s.version = Mult::VERSION
|
18
|
+
s.author = "John Mair (banisterfiend)"
|
19
|
+
s.email = 'jrmair@gmail.com'
|
20
|
+
s.date = Time.now.strftime '%Y-%m-%d'
|
21
|
+
s.require_path = 'lib'
|
22
|
+
s.homepage = "http://banisterfiend.wordpress.com"
|
23
|
+
# s.platform = 'i386-mingw32'
|
24
|
+
s.platform = Gem::Platform::RUBY
|
25
|
+
s.extensions = FileList["ext/**/extconf.rb"]
|
26
|
+
s.has_rdoc = 'yard'
|
27
|
+
s.files = ["Rakefile", "README.rdoc", "LICENSE", "lib/mult.rb", "lib/mult/version.rb"]
|
28
|
+
#+ ["lib/1.8/mult.#{dlext}", "lib/1.9/mult.#{dlext}"] +
|
29
|
+
FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c"].to_a
|
28
30
|
end
|
29
31
|
|
30
32
|
Rake::GemPackageTask.new(spec) do |pkg|
|
31
|
-
|
32
|
-
|
33
|
+
pkg.need_zip = false
|
34
|
+
pkg.need_tar = false
|
33
35
|
end
|
34
36
|
|
35
|
-
Rake::ExtensionTask.new('mult', spec) do |ext|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
37
|
+
# Rake::ExtensionTask.new('mult', spec) do |ext|
|
38
|
+
# ext.config_script = 'extconf.rb'
|
39
|
+
# ext.cross_compile = true
|
40
|
+
# ext.cross_platform = 'i386-mswin32'
|
41
|
+
# end
|
40
42
|
|
41
43
|
Rake::RDocTask.new do |rd|
|
42
44
|
rd.main = "README.rdoc"
|
data/lib/mult/version.rb
ADDED
data/lib/mult.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mult
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
10
11
|
platform: ruby
|
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-
|
18
|
+
date: 2010-10-20 00:00:00 +13:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -31,10 +32,9 @@ files:
|
|
31
32
|
- README.rdoc
|
32
33
|
- LICENSE
|
33
34
|
- lib/mult.rb
|
35
|
+
- lib/mult/version.rb
|
34
36
|
- ext/mult/extconf.rb
|
35
|
-
|
36
|
-
- ext/mult/mult.c
|
37
|
-
has_rdoc: true
|
37
|
+
has_rdoc: yard
|
38
38
|
homepage: http://banisterfiend.wordpress.com
|
39
39
|
licenses: []
|
40
40
|
|
@@ -44,23 +44,27 @@ rdoc_options: []
|
|
44
44
|
require_paths:
|
45
45
|
- lib
|
46
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
47
48
|
requirements:
|
48
49
|
- - ">="
|
49
50
|
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
50
52
|
segments:
|
51
53
|
- 0
|
52
54
|
version: "0"
|
53
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
54
57
|
requirements:
|
55
58
|
- - ">="
|
56
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
57
61
|
segments:
|
58
62
|
- 0
|
59
63
|
version: "0"
|
60
64
|
requirements: []
|
61
65
|
|
62
66
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.3.
|
67
|
+
rubygems_version: 1.3.7
|
64
68
|
signing_key:
|
65
69
|
specification_version: 3
|
66
70
|
summary: a few handy extensions to mess with ruby objects
|
data/ext/mult/compat.h
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
/* contains basic macros to facilitate ruby 1.8 and ruby 1.9 compatibility */
|
2
|
-
|
3
|
-
#ifndef GUARD_COMPAT_H
|
4
|
-
#define GUARD_COMPAT_H
|
5
|
-
|
6
|
-
#include <ruby.h>
|
7
|
-
|
8
|
-
/* this is the test we use to identify ruby 1.9.1 */
|
9
|
-
|
10
|
-
/* commenting out this test because it doesn't seem to work in 1.8.7 */
|
11
|
-
/*
|
12
|
-
#ifdef RCLASS_M_TBL
|
13
|
-
# define RUBY_19
|
14
|
-
#endif
|
15
|
-
*/
|
16
|
-
|
17
|
-
/* macros for backwards compatibility with 1.8 */
|
18
|
-
#ifndef RCLASS_M_TBL
|
19
|
-
# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
20
|
-
# define RCLASS_SUPER(c) (RCLASS(c)->super)
|
21
|
-
# define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
|
22
|
-
#endif
|
23
|
-
|
24
|
-
/* a useful macro. cannot use ordinary CLASS_OF as it does not return an lvalue */
|
25
|
-
#define KLASS_OF(c) (RBASIC(c)->klass)
|
26
|
-
|
27
|
-
#endif
|
data/ext/mult/mult.c
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
#include <ruby.h>
|
2
|
-
#include "compat.h"
|
3
|
-
|
4
|
-
|
5
|
-
/* return the actual class of an object */
|
6
|
-
static VALUE
|
7
|
-
get_class(VALUE self) {
|
8
|
-
|
9
|
-
return CLASS_OF(self);
|
10
|
-
}
|
11
|
-
|
12
|
-
/* set the class of an object */
|
13
|
-
static VALUE
|
14
|
-
set_class(VALUE self, VALUE klass) {
|
15
|
-
|
16
|
-
KLASS_OF(self) = klass;
|
17
|
-
|
18
|
-
return klass;
|
19
|
-
}
|
20
|
-
|
21
|
-
|
22
|
-
/* get the actual super class of an object */
|
23
|
-
static VALUE
|
24
|
-
get_super(VALUE self)
|
25
|
-
{
|
26
|
-
return RCLASS_SUPER(self);
|
27
|
-
}
|
28
|
-
|
29
|
-
/* set the super class of an object */
|
30
|
-
static VALUE
|
31
|
-
set_super(VALUE self, VALUE klass) {
|
32
|
-
|
33
|
-
RCLASS_SUPER(self) = klass;
|
34
|
-
|
35
|
-
return klass;
|
36
|
-
}
|
37
|
-
|
38
|
-
/* is the object a singleton class ? */
|
39
|
-
static VALUE
|
40
|
-
is_singleton(VALUE self, VALUE klass) {
|
41
|
-
|
42
|
-
return FL_TEST(self, FL_SINGLETON) ? Qtrue : Qfalse;
|
43
|
-
}
|
44
|
-
|
45
|
-
/* get the attached class if receiver is a singleton class */
|
46
|
-
static VALUE
|
47
|
-
get_attached(VALUE self)
|
48
|
-
{
|
49
|
-
if(FL_TEST(self, FL_SINGLETON))
|
50
|
-
return rb_iv_get(self, "__attached__");
|
51
|
-
else
|
52
|
-
return Qnil;
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
/* set the attached class if receiver is a singleton class */
|
57
|
-
static VALUE
|
58
|
-
set_attached(VALUE self, VALUE klass) {
|
59
|
-
if(FL_TEST(self, FL_SINGLETON)) {
|
60
|
-
rb_iv_set(self, "__attached__", klass);
|
61
|
-
return self;
|
62
|
-
}
|
63
|
-
else
|
64
|
-
return Qnil;
|
65
|
-
}
|
66
|
-
|
67
|
-
void
|
68
|
-
Init_mult() {
|
69
|
-
rb_define_method(rb_cObject, "actual_class", get_class, 0);
|
70
|
-
rb_define_method(rb_cObject, "actual_class=", set_class, 1);
|
71
|
-
|
72
|
-
rb_define_method(rb_cClass, "actual_super", get_super, 0);
|
73
|
-
rb_define_method(rb_cClass, "actual_super=", set_super, 1);
|
74
|
-
|
75
|
-
rb_define_method(rb_cClass, "is_singleton?", is_singleton, 0);
|
76
|
-
|
77
|
-
rb_define_method(rb_cClass, "attached", get_attached, 0);
|
78
|
-
rb_define_method(rb_cClass, "attached=", set_attached, 1);
|
79
|
-
}
|