direction 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/direction/version.rb +1 -1
- data/lib/direction.rb +2 -2
- data/test/direction_test.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99cab337abb6c620be8fe3226ced09dab0d5da77
|
4
|
+
data.tar.gz: d986a770755c0e04e05d14781ea6c6aa59b98d40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86177cffdf52eea6125884f34ab68e91f1cc445f6e8484dce645c63f20397f994c61bffa2159033f1595f64888f999885eb9d8dd7cc51c23af41a37b3c858dea
|
7
|
+
data.tar.gz: 3a0d61725e295c362273c653a4901e0226e1a64648c733aeff0e46cb2534c0852d213e87ea393ea2f5ccb38b4676b3de430708d14c31d7add889169054b91bfb
|
data/lib/direction/version.rb
CHANGED
data/lib/direction.rb
CHANGED
@@ -20,12 +20,12 @@ module Direction
|
|
20
20
|
Array(key).map do |command_name|
|
21
21
|
method_defs.unshift %{
|
22
22
|
def #{command_name}(*args, &block)
|
23
|
-
#{value}.__send__(:#{command_name})
|
23
|
+
#{value}.__send__(:#{command_name}, *args, &block)
|
24
24
|
self
|
25
25
|
end
|
26
26
|
}
|
27
27
|
end
|
28
28
|
end
|
29
|
-
self.class_eval method_defs.join(' ')
|
29
|
+
self.class_eval method_defs.join(' '), __FILE__, __LINE__
|
30
30
|
end
|
31
31
|
end
|
data/test/direction_test.rb
CHANGED
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class Person
|
4
4
|
extend Direction
|
5
|
-
command :make_me_a_sandwich => :@friend
|
5
|
+
command [:make_me_a_sandwich, :cook] => :@friend
|
6
6
|
attr_accessor :friend
|
7
7
|
end
|
8
8
|
|
@@ -10,6 +10,10 @@ class Friend
|
|
10
10
|
def make_me_a_sandwich
|
11
11
|
Menu.record "I made a sandwich!"
|
12
12
|
end
|
13
|
+
|
14
|
+
def cook(what)
|
15
|
+
Menu.record what
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
module Menu
|
@@ -42,4 +46,10 @@ describe Direction do
|
|
42
46
|
it 'returns the original receiver' do
|
43
47
|
assert_equal person, person.make_me_a_sandwich
|
44
48
|
end
|
49
|
+
|
50
|
+
it 'forwards additional arguments' do
|
51
|
+
assert_equal [], Menu.list
|
52
|
+
person.cook('yum')
|
53
|
+
assert_includes Menu.list, "yum"
|
54
|
+
end
|
45
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: direction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Jim Gay'"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|