rns 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rns (0.0.4)
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.1)
11
+ guard (1.0.2)
12
12
  ffi (>= 0.5.0)
13
13
  thor (~> 0.14.6)
14
- guard-rspec (0.5.8)
15
- guard (>= 0.8.4)
16
- multi_json (1.0.3)
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.7.0)
19
- rspec-core (~> 2.7.0)
20
- rspec-expectations (~> 2.7.0)
21
- rspec-mocks (~> 2.7.0)
22
- rspec-core (2.7.1)
23
- rspec-expectations (2.7.0)
24
- diff-lcs (~> 1.1.2)
25
- rspec-mocks (2.7.0)
26
- simplecov (0.5.4)
27
- multi_json (~> 1.0.3)
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 "1+1 is #{self.class.inc 1} and the average of [1,2,3] is #{avg [1,2,3]}"
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) do |*args|
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
@@ -1,3 +1,3 @@
1
1
  module Rns
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
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-07 00:00:00.000000000 Z
12
+ date: 2012-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec