remix 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +11 -8
- data/Rakefile +8 -8
- data/lib/remix.rb +32 -1
- data/lib/remix/c_docs.rb +7 -6
- data/lib/remix/version.rb +1 -1
- metadata +6 -3
data/README.markdown
CHANGED
@@ -16,18 +16,19 @@ remove modules, replace modules, move modules around and otherwise
|
|
16
16
|
* Read the [documentation](http://rdoc.info/github/banister/remix/master/file/README.markdown)
|
17
17
|
* See the [source code](http://github.com/banister/remix)
|
18
18
|
|
19
|
-
example:
|
20
|
-
|
19
|
+
example: temp_include():
|
20
|
+
------------------------
|
21
21
|
|
22
|
-
Using `
|
23
|
-
|
22
|
+
Using `temp_include` we can temporaliy mix in a module for the
|
23
|
+
duration of a block:
|
24
24
|
|
25
|
-
M
|
25
|
+
module M def hello() :hello end end
|
26
26
|
|
27
|
-
M
|
27
|
+
String.temp_include(M) do
|
28
|
+
puts "test".hello #=> "hello"
|
29
|
+
end
|
28
30
|
|
29
|
-
|
30
|
-
M.ancestors #=> [M, A, B, C, J]
|
31
|
+
"test".hello #=> NoMethodError
|
31
32
|
|
32
33
|
example: unextend()
|
33
34
|
--------------------
|
@@ -90,6 +91,7 @@ Full list of functions
|
|
90
91
|
|
91
92
|
**include-based functions:**
|
92
93
|
|
94
|
+
* temp_include(mod)
|
93
95
|
* include_at(index, mod)
|
94
96
|
* include_at_top(mod)
|
95
97
|
* include_before(before_mod, mod)
|
@@ -102,6 +104,7 @@ Full list of functions
|
|
102
104
|
|
103
105
|
**extend-based functions:**
|
104
106
|
|
107
|
+
* temp_extend(mod)
|
105
108
|
* extend_at(index, mod)
|
106
109
|
* extend_at_top(mod)
|
107
110
|
* extend_before(before_mod, mod)
|
data/Rakefile
CHANGED
@@ -5,9 +5,9 @@ require 'rake/clean'
|
|
5
5
|
require 'rake/gempackagetask'
|
6
6
|
require "#{direc}/lib/remix/version"
|
7
7
|
|
8
|
-
|
9
|
-
CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
|
10
8
|
CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
|
9
|
+
CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~",
|
10
|
+
"ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
|
11
11
|
|
12
12
|
def apply_spec_defaults(s)
|
13
13
|
s.name = "remix"
|
@@ -20,10 +20,11 @@ def apply_spec_defaults(s)
|
|
20
20
|
s.require_path = 'lib'
|
21
21
|
s.homepage = "http://banisterfiend.wordpress.com"
|
22
22
|
s.has_rdoc = 'yard'
|
23
|
-
s.files =
|
24
|
-
"test/*.rb", "CHANGELOG", "README.markdown", "Rakefile"]
|
23
|
+
s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib/**/*.rb",
|
24
|
+
"test/*.rb", "CHANGELOG", "README.markdown", "Rakefile"]
|
25
25
|
end
|
26
26
|
|
27
|
+
desc "run tests"
|
27
28
|
task :test do
|
28
29
|
sh "bacon -k #{direc}/test/test.rb"
|
29
30
|
end
|
@@ -56,9 +57,11 @@ namespace :ruby do
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
60
|
+
desc "build the 1.8 and 1.9 binaries from source and copy to lib/"
|
59
61
|
task :compile do
|
60
62
|
build_for = proc do |pik_ver, ver|
|
61
63
|
sh %{ \
|
64
|
+
c:\\devkit\\devkitvars.bat && \
|
62
65
|
pik #{pik_ver} && \
|
63
66
|
ruby extconf.rb && \
|
64
67
|
make clean && \
|
@@ -69,7 +72,7 @@ task :compile do
|
|
69
72
|
|
70
73
|
chdir("#{direc}/ext/remix") do
|
71
74
|
build_for.call("187", "1.8")
|
72
|
-
build_for.call("
|
75
|
+
build_for.call("192", "1.9")
|
73
76
|
end
|
74
77
|
end
|
75
78
|
|
@@ -87,6 +90,3 @@ task :pushgems => :gems do
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
data/lib/remix.rb
CHANGED
@@ -44,6 +44,19 @@ module Remix
|
|
44
44
|
# Temporarily extends a module for the duration of a block.
|
45
45
|
# Module will be unextended at end of block.
|
46
46
|
# @param [Module] mod Module to be temporarily extended
|
47
|
+
# @example
|
48
|
+
# module M
|
49
|
+
# def hello
|
50
|
+
# :hello
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# o = Object.new
|
55
|
+
# o.temp_extend(M) do
|
56
|
+
# puts hello #=> "hello"
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# o.hello #=> NoMethodError
|
47
60
|
def temp_extend(mod, options={}, &block)
|
48
61
|
Remix.wrap_with_hooks(options[:before], options[:after]) do
|
49
62
|
begin
|
@@ -131,10 +144,16 @@ module Remix
|
|
131
144
|
end
|
132
145
|
|
133
146
|
# Like `replace_module()` but for the singleton class
|
134
|
-
# @see Remix::ModuleExtensions#
|
147
|
+
# @see Remix::ModuleExtensions#replace_module
|
135
148
|
def replace_extended_module(mod1, mod2)
|
136
149
|
singleton_class.replace_module(mod1, mod2)
|
137
150
|
end
|
151
|
+
|
152
|
+
# Like `ready_remix()` on `Module` but for the singleton class
|
153
|
+
# @see Remix::ModuleExtensions#ready_remix
|
154
|
+
def ready_remix()
|
155
|
+
singleton_class.ready_remix
|
156
|
+
end
|
138
157
|
end
|
139
158
|
|
140
159
|
module Remix::ModuleExtensions
|
@@ -142,6 +161,18 @@ module Remix
|
|
142
161
|
# Temporarily includes a module for the duration of a block.
|
143
162
|
# Module will be unincluded at end of block.
|
144
163
|
# @param [Module] mod Module to be temporarily included
|
164
|
+
# @example
|
165
|
+
# module M
|
166
|
+
# def hello
|
167
|
+
# :hello
|
168
|
+
# end
|
169
|
+
# end
|
170
|
+
#
|
171
|
+
# String.temp_include(M) do
|
172
|
+
# puts "friendo".hello #=> "hello"
|
173
|
+
# end
|
174
|
+
#
|
175
|
+
# "friendo".hello #=> NoMethodError
|
145
176
|
def temp_include(mod, options={}, &block)
|
146
177
|
Remix.wrap_with_hooks(options[:before], options[:after]) do
|
147
178
|
begin
|
data/lib/remix/c_docs.rb
CHANGED
@@ -8,12 +8,7 @@ module Remix
|
|
8
8
|
# @param [Module] mod The module to include
|
9
9
|
# @return [Module] The receiver
|
10
10
|
# @example
|
11
|
-
#
|
12
|
-
# module N end
|
13
|
-
# module O end
|
14
|
-
# module P
|
15
|
-
# include M, N
|
16
|
-
# end
|
11
|
+
# P.ancestors #=> [P, M, N]
|
17
12
|
# P.include_at 2, O
|
18
13
|
# P.ancestors #=> [P, M, O, N]
|
19
14
|
def include_at(index, mod) end
|
@@ -110,5 +105,11 @@ module Remix
|
|
110
105
|
# M.replace_module B, J
|
111
106
|
# M.ancestors #=> [M, A, J]
|
112
107
|
def replace_module(mod1, mod2) end
|
108
|
+
|
109
|
+
# Prepares the receiver's ancestor chain for remixing. This method
|
110
|
+
# is called automatically by all remixing methods and should
|
111
|
+
# never need to be invoked by the user.
|
112
|
+
# @return [Object] The receiver
|
113
|
+
def ready_remix() end
|
113
114
|
end
|
114
115
|
end
|
data/lib/remix/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 7
|
10
|
+
version: 0.4.7
|
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-11-
|
18
|
+
date: 2010-11-15 00:00:00 +13:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -52,6 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
53
|
requirements:
|
53
54
|
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
55
57
|
segments:
|
56
58
|
- 0
|
57
59
|
version: "0"
|
@@ -60,6 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
62
|
requirements:
|
61
63
|
- - ">="
|
62
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
63
66
|
segments:
|
64
67
|
- 0
|
65
68
|
version: "0"
|