Class: RSpec::JsonMatchers::Utils::CollectionKeysExtractor Private
- Inherits:
-
Object
- Object
- RSpec::JsonMatchers::Utils::CollectionKeysExtractor
- Defined in:
- lib/rspec/json_matchers/utils/collection_keys_extractor.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #collection ⇒ Object readonly private
Class Method Summary collapse
-
.extract(collection) ⇒ Set
private
Set of keys/indexes of the collection.
Instance Method Summary collapse
- #extract ⇒ Object private
-
#initialize(collection) ⇒ CollectionKeysExtractor
constructor
private
A new instance of CollectionKeysExtractor.
Constructor Details
#initialize(collection) ⇒ CollectionKeysExtractor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CollectionKeysExtractor.
23 24 25 |
# File 'lib/rspec/json_matchers/utils/collection_keys_extractor.rb', line 23 def initialize(collection) @collection = collection end |
Instance Attribute Details
#collection ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/rspec/json_matchers/utils/collection_keys_extractor.rb', line 21 def collection @collection end |
Class Method Details
.extract(collection) ⇒ Set
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns set of keys/indexes of the collection.
11 12 13 |
# File 'lib/rspec/json_matchers/utils/collection_keys_extractor.rb', line 11 def self.extract(collection) new(collection).extract end |
Instance Method Details
#extract ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 |
# File 'lib/rspec/json_matchers/utils/collection_keys_extractor.rb', line 27 def extract COLLECTION_TYPE_TO_VALUE_EXTRACTION_PROC_MAP. fetch(collection.class) do fail TypeError end.call(collection) end |