coactive 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7c25e57f4b9e1c2519945529c1026470f77faa37a59753789e6c821270a3bfd
4
- data.tar.gz: 447682aaf62af161dbdc3ac8d2a7bebdf5a39ae78a106e6163b86b916e0f69b9
3
+ metadata.gz: 81adac1b8a25c283b42061c7cea9d08bc4ee06987fe2de6aba8ccee17a40e12d
4
+ data.tar.gz: ae0509c320a8e32f10dff9820d8c92adc60dee58797c6ba1d6befd206d923781
5
5
  SHA512:
6
- metadata.gz: 9e4df828d91f088d1b99784bc7456cc160633b66961431e36dcb5fba5994659718cde602b4433b4510517daf29a63b4af733e7218aa5cd27066415c8efe92456
7
- data.tar.gz: 99aa8892d8a1f6324e5e587d13e44259088badc9ab923cd6969c0b746d7c3a8b1bb834827117569f75782c243de4fe43d5324025eb247cff27f04ff04a8fce05
6
+ metadata.gz: c501671b40e84f6bf4951318db3e77e67eaa5ac7fc2120f03b6038402a9f61d4dd9ae95c4859307902f9dc5bfb0d83f193d04b1bbc8c3a9c7544b56f46c567d4
7
+ data.tar.gz: 91a4346db771c3b0ddb21c07fcf9892e8580243e80916988159b2b5a11813ea39f50b225dc21bdd74faa2430e38fbf4a1fe6ffb91a2a50d264f6744b261fb50b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.1
4
+
5
+ * Fix max length of inspected string.
6
+ * Fix inspect of nil.
7
+ * Fix inspect of objects with id or attributes.
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  * Simplify inspect of context.
@@ -7,7 +7,7 @@ module Coactive
7
7
  class_attribute :max_num, :max_length, :basic_classes
8
8
  self.max_num = 3
9
9
  self.max_length = 100
10
- self.basic_classes = [Module, Symbol, String, Numeric, TrueClass, FalseClass, Regexp]
10
+ self.basic_classes = [Module, Symbol, String, Numeric, TrueClass, FalseClass, NilClass, Regexp]
11
11
 
12
12
  def call(data)
13
13
  if data.is_a?(Array)
@@ -36,11 +36,22 @@ module Coactive
36
36
  end
37
37
 
38
38
  def inspect_basic(data)
39
- data.inspect
39
+ inspected = data.inspect
40
+ if inspected.length > max_length
41
+ inspected[0..max_length] + '...'
42
+ else
43
+ inspected
44
+ end
40
45
  end
41
46
 
42
47
  def inspect_object(data)
43
- "#<#{data.class}:#{data.object_id}>"
48
+ if data.respond_to?(:id)
49
+ "#<#{data.class}/#{data.id}>"
50
+ elsif data.respond_to?(:attributes) && (attributes = data.attributes).is_a?(Hash)
51
+ "#<#{data.class} #{inspect_hash(attributes)}>"
52
+ else
53
+ "#<#{data.class}:#{data.object_id}>"
54
+ end
44
55
  end
45
56
  end
46
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coactive
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta