object_identifier 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7843244c5e224517bddb65379fe1b6562efd2935d7726baff7dbffe966060b2c
4
- data.tar.gz: 9a6cf071bda7dd1ba2c310dcd102b07cd61468ea4f6b277d3e3df85112f84129
3
+ metadata.gz: 594dc64f6fbb19ee55894da1b9c1e122d23cea3eec1caf78e13671e8e0472e61
4
+ data.tar.gz: 3842e0eba2e37555e020c44e679383422ad29f12f2945e3918cdd0e76c5998ff
5
5
  SHA512:
6
- metadata.gz: 531ff0b0ccc60363bb314880338722895aff52c08d75afc46a96169a57615861fa40bbf54bc5dc68578774d21093037a18d87bec0546029d4e9190d604f36ddf
7
- data.tar.gz: 820522d77a2e085b67abd510a7af0405c1e240b1e64d08dde2a0d2f3a55579e3e6f2d5d750d0e9f0a8cdf1245ad0b71c2a1dbe1208c5f27b6800fdb8afe7ae20
6
+ metadata.gz: 195fbb54d47c00305d2b46d640db4629dc75deac68ec70c70679b90ec07cbf482dfe747dc1e6d2ae262bf3c85eb46d03aea312e377b528815635ba86db4ada2c
7
+ data.tar.gz: bd36eac52299c54da4d2a99ad02d9c8e0a04ba82260b59255183ba734b93460cbb49b3105d6863729be96035e79486e75c5763e3ba661e2d696cbd84d606d9e6
@@ -11,15 +11,18 @@ Layout/DotPosition:
11
11
  Layout/EndOfLine:
12
12
  EnforcedStyle: lf
13
13
 
14
- Layout/FirstParameterIndentation:
14
+ Layout/IndentFirstArgument:
15
15
  EnforcedStyle: consistent_relative_to_receiver
16
16
 
17
- Layout/IndentArray:
17
+ Layout/IndentFirstArrayElement:
18
18
  EnforcedStyle: consistent
19
19
 
20
- Layout/IndentHash:
20
+ Layout/IndentFirstHashElement:
21
21
  EnforcedStyle: consistent
22
22
 
23
+ Layout/IndentFirstParameter:
24
+ Enabled: false # Revisit if more settings become available.
25
+
23
26
  Layout/MultilineMethodCallBraceLayout:
24
27
  EnforcedStyle: same_line
25
28
 
@@ -38,9 +41,6 @@ Lint/AmbiguousOperator:
38
41
  Lint/AmbiguousRegexpLiteral:
39
42
  Enabled: false # Conflicts with other rules.
40
43
 
41
- Lint/SplatKeywordArguments:
42
- Enabled: false # Removed from Rubocop; Remove this after upgrade.
43
-
44
44
  Lint/Void:
45
45
  CheckForMethodsWithNoSideEffects: true
46
46
 
@@ -1,14 +1,14 @@
1
- ### 0.1.0 - 2019-02-24
1
+ ### 0.3.0 - 2019-06-27
2
+ - Fix identification of objects that implement `to_a`, such as Struct.
2
3
 
4
+ ### 0.2.1 - 2019-02-24
3
5
  - Add ability to identify instance vars
4
6
 
5
7
  ### 0.1.0 - 2018-04-14
6
-
7
8
  - Revamp gem.
8
9
  - Update gem dependencies.
9
10
  - Now returns "[no objects]" even if given a :klass option.
10
11
 
11
12
 
12
13
  ### 0.0.6 - 2016-02-06
13
-
14
14
  - Fix: identify method now supports private & protected methods.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- object_identifier (0.2.1)
4
+ object_identifier (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -13,7 +13,7 @@ GEM
13
13
  ice_nine (~> 0.11.0)
14
14
  thread_safe (~> 0.3, >= 0.3.1)
15
15
  builder (3.2.3)
16
- byebug (11.0.0)
16
+ byebug (11.0.1)
17
17
  codeclimate-engine-rb (0.4.1)
18
18
  virtus (~> 1.0)
19
19
  coderay (1.1.2)
@@ -21,10 +21,10 @@ GEM
21
21
  descendants_tracker (~> 0.0.1)
22
22
  descendants_tracker (0.0.4)
23
23
  thread_safe (~> 0.3, >= 0.3.1)
24
- docile (1.3.1)
24
+ docile (1.3.2)
25
25
  equalizer (0.0.11)
26
26
  ice_nine (0.11.2)
27
- jaro_winkler (1.5.2)
27
+ jaro_winkler (1.5.3)
28
28
  json (2.2.0)
29
29
  kwalify (0.7.2)
30
30
  method_source (0.9.2)
@@ -34,10 +34,9 @@ GEM
34
34
  builder
35
35
  minitest (>= 5.0)
36
36
  ruby-progressbar
37
- parallel (1.13.0)
38
- parser (2.6.0.0)
37
+ parallel (1.17.0)
38
+ parser (2.6.3.0)
39
39
  ast (~> 2.4.0)
40
- powerpack (0.1.2)
41
40
  pry (0.12.2)
42
41
  coderay (~> 1.1.0)
43
42
  method_source (~> 0.9.0)
@@ -47,29 +46,27 @@ GEM
47
46
  psych (3.1.0)
48
47
  rainbow (3.0.0)
49
48
  rake (12.3.2)
50
- reek (5.3.1)
49
+ reek (5.4.0)
51
50
  codeclimate-engine-rb (~> 0.4.0)
52
51
  kwalify (~> 0.7.0)
53
52
  parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
54
53
  psych (~> 3.1.0)
55
54
  rainbow (>= 2.0, < 4.0)
56
- rubocop (0.65.0)
55
+ rubocop (0.72.0)
57
56
  jaro_winkler (~> 1.5.1)
58
57
  parallel (~> 1.10)
59
- parser (>= 2.5, != 2.5.1.1)
60
- powerpack (~> 0.1)
61
- psych (>= 3.1.0)
58
+ parser (>= 2.6)
62
59
  rainbow (>= 2.2.2, < 4.0)
63
60
  ruby-progressbar (~> 1.7)
64
- unicode-display_width (~> 1.4.0)
65
- ruby-progressbar (1.10.0)
61
+ unicode-display_width (>= 1.4.0, < 1.7)
62
+ ruby-progressbar (1.10.1)
66
63
  simplecov (0.16.1)
67
64
  docile (~> 1.1)
68
65
  json (>= 1.8, < 3)
69
66
  simplecov-html (~> 0.10.0)
70
67
  simplecov-html (0.10.2)
71
68
  thread_safe (0.3.6)
72
- unicode-display_width (1.4.1)
69
+ unicode-display_width (1.6.0)
73
70
  virtus (1.0.5)
74
71
  axiom-types (~> 0.1)
75
72
  coercible (~> 1.0)
@@ -44,7 +44,7 @@ module ObjectIdentifier
44
44
  end
45
45
 
46
46
  def initialize(objects, *args, limit: nil, klass: :not_given)
47
- @objects = Array(objects)
47
+ @objects = ArrayWrap.call(objects)
48
48
  @attributes = args.empty? ? [:id] : args
49
49
  @limit = (limit || @objects.size).to_i
50
50
  @klass = klass
@@ -131,7 +131,23 @@ module ObjectIdentifier
131
131
  end
132
132
 
133
133
  def truncated?
134
- truncated_objects_count > 0
134
+ truncated_objects_count.positive?
135
+ end
136
+
137
+ # ObjectIdentifier::Identifier::ArrayWrap mirrors the implementation of
138
+ # Rails' {Array.wrap} method. This allows us to get around objects that
139
+ # respond to `to_a` (such as Struct) and, instead, utilize either `to_ary`
140
+ # or just actually wrapping the object in an Array.
141
+ class ArrayWrap
142
+ def self.call(object)
143
+ if object.nil?
144
+ []
145
+ elsif object.respond_to?(:to_ary)
146
+ object.to_ary || [object]
147
+ else
148
+ [object]
149
+ end
150
+ end
135
151
  end
136
152
  end
137
153
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ObjectIdentifier
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_identifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dobbins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-02-24 00:00:00.000000000 Z
12
+ date: 2019-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.0.2
202
+ rubygems_version: 3.0.4
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: ObjectIdentifier identifies an object by its class name and attributes.