code-ruby 1.7.0 → 1.7.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/code/type/sig.rb +24 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae4f4f54df6fd8223b110e202a6cfe856b7c9b693f60630910c4b3247d4b308
|
4
|
+
data.tar.gz: 43ff1552be464bc72268595e3fb72a4aaad6011f7b1f1224e4599ee7f51fffc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6fdc17eed4d75d91097db42fe1bf0b0d53ebaca8580fd6f8fb738c98ebdfaeb5c76a495d4d08fa17e76222d3ac4d1be357839e55438c1f04340e75f311e8227
|
7
|
+
data.tar.gz: b8028a6bc4bcda64cecf557a2cc8b730e106e0f252a1d25fda041219fc39d66407a733ddc09a6703b452e1e1bd6cd3614ea58d29ba81f433c89b40c70d3a084c
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.1
|
data/lib/code/type/sig.rb
CHANGED
@@ -61,11 +61,27 @@ class Code
|
|
61
61
|
max_arguments.include?(nil) ? nil : max_arguments.sum
|
62
62
|
end
|
63
63
|
|
64
|
+
def min_actual_arguments
|
65
|
+
actual_arguments.size
|
66
|
+
end
|
67
|
+
|
68
|
+
def max_actual_arguments
|
69
|
+
actual_arguments.sum do |argument|
|
70
|
+
argument.is_an?(Object::Dictionary) ? argument.code_size.raw : 1
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
64
74
|
def actual_count
|
65
|
-
if
|
66
|
-
|
75
|
+
if min_actual_arguments == max_actual_arguments
|
76
|
+
if min_actual_arguments == 1
|
77
|
+
"1 actual argument"
|
78
|
+
else
|
79
|
+
"#{min_actual_arguments} actual arguments"
|
80
|
+
end
|
81
|
+
elsif max_actual_arguments.nil?
|
82
|
+
"#{min_actual_arguments}+ actual arguments"
|
67
83
|
else
|
68
|
-
"#{
|
84
|
+
"#{min_actual_arguments}-#{max_actual_arguments} actual arguments"
|
69
85
|
end
|
70
86
|
end
|
71
87
|
|
@@ -87,8 +103,12 @@ class Code
|
|
87
103
|
max_arguments.nil? ? min_arguments.. : min_arguments..max_arguments
|
88
104
|
end
|
89
105
|
|
106
|
+
def actual_range
|
107
|
+
min_actual_arguments..max_actual_arguments
|
108
|
+
end
|
109
|
+
|
90
110
|
def check_number_of_arguments!
|
91
|
-
return if expected_range.
|
111
|
+
return if expected_range.overlaps?(actual_range)
|
92
112
|
|
93
113
|
raise(
|
94
114
|
Error,
|