rns 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +15 -15
- data/README.md +5 -1
- data/lib/rns.rb +1 -3
- data/lib/rns/version.rb +1 -1
- data/spec/rns/rns_spec.rb +12 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rns (0.0.
|
4
|
+
rns (0.0.5)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
diff-lcs (1.1.3)
|
10
10
|
ffi (1.0.11)
|
11
|
-
guard (1.0.
|
11
|
+
guard (1.0.2)
|
12
12
|
ffi (>= 0.5.0)
|
13
13
|
thor (~> 0.14.6)
|
14
|
-
guard-rspec (0.
|
15
|
-
guard (>= 0.
|
16
|
-
multi_json (1.
|
14
|
+
guard-rspec (0.7.0)
|
15
|
+
guard (>= 0.10.0)
|
16
|
+
multi_json (1.3.4)
|
17
17
|
rake (0.9.2.2)
|
18
|
-
rspec (2.
|
19
|
-
rspec-core (~> 2.
|
20
|
-
rspec-expectations (~> 2.
|
21
|
-
rspec-mocks (~> 2.
|
22
|
-
rspec-core (2.
|
23
|
-
rspec-expectations (2.
|
24
|
-
diff-lcs (~> 1.1.
|
25
|
-
rspec-mocks (2.
|
26
|
-
simplecov (0.
|
27
|
-
multi_json (~> 1.
|
18
|
+
rspec (2.10.0)
|
19
|
+
rspec-core (~> 2.10.0)
|
20
|
+
rspec-expectations (~> 2.10.0)
|
21
|
+
rspec-mocks (~> 2.10.0)
|
22
|
+
rspec-core (2.10.0)
|
23
|
+
rspec-expectations (2.10.0)
|
24
|
+
diff-lcs (~> 1.1.3)
|
25
|
+
rspec-mocks (2.10.1)
|
26
|
+
simplecov (0.6.2)
|
27
|
+
multi_json (~> 1.3)
|
28
28
|
simplecov-html (~> 0.5.3)
|
29
29
|
simplecov-html (0.5.3)
|
30
30
|
thor (0.14.6)
|
data/README.md
CHANGED
@@ -27,8 +27,12 @@ class Main
|
|
27
27
|
extend Rns.use(Arithmetic => [:inc])
|
28
28
|
include Rns.use(Statistics => [:avg])
|
29
29
|
|
30
|
+
def self.incremented(n)
|
31
|
+
"#{n} incremented is #{inc n}"
|
32
|
+
end
|
33
|
+
|
30
34
|
def main
|
31
|
-
puts "
|
35
|
+
puts "#{self.class.incremented 1} and the average of [1,2,3] is #{avg [1,2,3]}"
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
data/lib/rns.rb
CHANGED
@@ -31,9 +31,7 @@ module Rns
|
|
31
31
|
|
32
32
|
def add_methods(to, use_spec)
|
33
33
|
process_spec(use_spec).each do |from, method|
|
34
|
-
to.send(:define_method, method)
|
35
|
-
from.method(method).call(*args)
|
36
|
-
end
|
34
|
+
to.send(:define_method, method, &from.method(method))
|
37
35
|
to.send(:private, method)
|
38
36
|
end
|
39
37
|
end
|
data/lib/rns/version.rb
CHANGED
data/spec/rns/rns_spec.rb
CHANGED
@@ -22,6 +22,10 @@ module Math
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
module BlockTakers
|
26
|
+
def self.takes_block(&blk); yield; end
|
27
|
+
end
|
28
|
+
|
25
29
|
module Util
|
26
30
|
class << self
|
27
31
|
def assoc!(h, k, v)
|
@@ -129,6 +133,14 @@ describe Rns do
|
|
129
133
|
lambda { Class.new.inc 1 }.should raise_error(NoMethodError)
|
130
134
|
end
|
131
135
|
|
136
|
+
it "imports a method that takes a block" do
|
137
|
+
Rns::using(BlockTakers => [:takes_block]) do
|
138
|
+
takes_block do
|
139
|
+
:returned_from_block
|
140
|
+
end.should == :returned_from_block
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
132
144
|
it 'processes specs correctly' do
|
133
145
|
Rns::using(Rns => [:process_spec]) do
|
134
146
|
process_spec({Math => [:inc, :dec]}).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|