rogerdpack-arguments 0.4.7.3 → 0.4.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/arguments/class.rb +4 -1
- data/spec/arguments_spec.rb +3 -1
- metadata +1 -1
data/lib/arguments/class.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
module NamedArgs
|
2
2
|
def named_arguments_for *methods
|
3
3
|
methods = instance_methods - Object.methods if methods.empty?
|
4
4
|
|
@@ -46,3 +46,6 @@ class Class
|
|
46
46
|
alias :named_args :named_arguments_for
|
47
47
|
|
48
48
|
end
|
49
|
+
|
50
|
+
class Class; include NamedArgs; end
|
51
|
+
class Module; include NamedArgs; end
|
data/spec/arguments_spec.rb
CHANGED
@@ -6,6 +6,7 @@ describe Arguments do
|
|
6
6
|
before do
|
7
7
|
Object.send(:remove_const, 'Klass') rescue nil
|
8
8
|
load "#{ File.dirname __FILE__ }/klass.rb"
|
9
|
+
load "#{ File.dirname __FILE__ }/module.rb"
|
9
10
|
@instance = Klass.new
|
10
11
|
end
|
11
12
|
|
@@ -109,7 +110,8 @@ describe Arguments do
|
|
109
110
|
end
|
110
111
|
|
111
112
|
it "should work with modules too" do
|
112
|
-
|
113
|
+
TestMod.send( :named_arguments_for, :go)
|
114
|
+
IncludesTestMod.new.go(:a => 1).should == 1
|
113
115
|
end
|
114
116
|
|
115
117
|
it "should benchmark with hack" do
|