structure 0.27.3 → 0.27.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/structure.rb +7 -1
- data/{structure_test.rb → test.rb} +8 -0
- 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: b67fbe24cad1e50983d1ea7d57cb72478f028805
|
4
|
+
data.tar.gz: b233d50e95cfeacf2083bea2578961b880d5524b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1451461d6a80e1ecd5072efea01f57916acbff487b1852b648409107b6a0a48dfa6f9cfbd77913cab39e1a4e2b96755d5853b9ec905203005767348551667b7
|
7
|
+
data.tar.gz: a1d4edb3c2bd35a30e53ac728c23f5aacc04af07b7276471fc6b2de6a149cb0d0e48a6096ca9bfa0cc4ccecac02dac2992b464cd6b338db22ea191c7ad5e8e57
|
data/structure.rb
CHANGED
@@ -18,7 +18,13 @@ module Structure
|
|
18
18
|
def inspect
|
19
19
|
"#<#{self.class} #{
|
20
20
|
attributes
|
21
|
-
.map { |key, val|
|
21
|
+
.map { |key, val|
|
22
|
+
if val.is_a?(Array) && val.size > 3
|
23
|
+
"#{key}=[#{val.take(3).map(&:inspect).join(', ')}...]"
|
24
|
+
else
|
25
|
+
"#{key}=#{val.inspect}"
|
26
|
+
end
|
27
|
+
}
|
22
28
|
.join(', ')
|
23
29
|
}>"
|
24
30
|
end
|
@@ -57,4 +57,12 @@ class StructureTest < MiniTest::Test
|
|
57
57
|
assert_equal '#<Location latitude=10, longitude=20>', @location.inspect
|
58
58
|
assert_equal @location.to_s, @location.inspect
|
59
59
|
end
|
60
|
+
|
61
|
+
def test_truncates_long_arrays_when_pretty_inspecting
|
62
|
+
klass = Class.new { include Structure }
|
63
|
+
klass.attribute(:ary) { ['a'] }
|
64
|
+
assert_includes klass.new.inspect, 'ary=["a"]'
|
65
|
+
klass.attribute(:ary) { ('a'..'z').to_a }
|
66
|
+
assert_includes klass.new.inspect, 'ary=["a", "b", "c"...]'
|
67
|
+
end
|
60
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
@@ -47,7 +47,7 @@ files:
|
|
47
47
|
- LICENSE
|
48
48
|
- README.md
|
49
49
|
- structure.rb
|
50
|
-
-
|
50
|
+
- test.rb
|
51
51
|
homepage:
|
52
52
|
licenses: []
|
53
53
|
metadata: {}
|