array-symmetries 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/array.rb +6 -0
- 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: e2e9c7cdb534452b02aaa4f93594d3e0e3a1fdcc641c3bfe6d3710bacb70bdba
|
4
|
+
data.tar.gz: 21b30dc1caaf70fef3701e8693b89c84de64012768460decc8f27532bdd9c7c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75cdd082d1e142347f3fb7d6edfb1f0c0e171c42913d132ac95861140e95e3887a01678d85dddfe47f7f8c8e0dd27c4e6b13a9f09598269b298c329b8443aa5
|
7
|
+
data.tar.gz: 2801208239461b0b85cd653329bebf7d9b140b359ca0afd9dcb37fc405e51291b1c3e9541faba116a08efc60cc13427da804f8f6f35d3e46b10b81425156d4fc
|
data/lib/array.rb
CHANGED
@@ -25,5 +25,11 @@ class Array # yeah it's a monkey patch
|
|
25
25
|
raise ArgumentError unless square?
|
26
26
|
[self, b, a, a.a, a.a.a, a.b, a.a.b, a.a.a.b]
|
27
27
|
end
|
28
|
+
|
29
|
+
# Returns a 2x2 array consisting of the four corners of the original square.
|
30
|
+
def corners
|
31
|
+
raise ArgumentError unless square?
|
32
|
+
[[first.first, first.last], [last.first, last.last]]
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|