deeply_enumerable 0.9.2 → 1.0.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: eae0841086c0da8d042453e9a3bbb184099e134b1af550b936361df36f4c1503
4
- data.tar.gz: 95851be8f55f8da1b518b409db283394672f94fe1995cf74bd5bbb5e1054f17f
3
+ metadata.gz: 8f9655518ad0bb3d8c2d3eb6616c2d9862e439d4b0ab4b45be6752b18628ecb1
4
+ data.tar.gz: 280db3869191e9c9fb318baed1b99b6ebc3f90ff24c16993523fe47eceff26fb
5
5
  SHA512:
6
- metadata.gz: 175c6f0ebf20d033532cbe171d532aa24f9461facb8951f630fdfd672710b7f61994374b6f5ecd3f7b944ba039d3bd67012809e36769cd3a582ef1a4fa768d58
7
- data.tar.gz: 41fa00c185d23a48c8c89bcd5d42d076a4e555643453bd382d2031f335466a3949106555b09b8d72a5db5f94e77d68f0413916a114eec2e24c60d23e9067d9e8
6
+ metadata.gz: 6939a317d815e1c0d6cfdc65f75f506cb549978b8338ef4f604086cb5efe7b4959d3ab3112691d068fa8f28082cb6753d3ae9177c5909ec56e0dd537c9c557b5
7
+ data.tar.gz: 3d07a34bb72ed5c3f37ce106daf0c30eef47d46af22e29e3278cfcefbbafdd607db395abbb38b4b34531aceaef9af8c46a29d37587b170703dc4aafb17edafd6
data/README.md CHANGED
@@ -23,7 +23,7 @@ $ DeeplyEnumerable::Array.deep_compact(Array)
23
23
 
24
24
  These methos will retrun a `DeeplyEnumerable` type object matching the object passed, e.g: `Array` will return a `DeeplyEnumerable::Array`
25
25
 
26
- You may also extend base classes if you `require: 'base_extensions'` as described in *Installation*
26
+ You may also extend base classes if you `require: "base_extensions"` as described in *Installation*
27
27
  ```ruby
28
28
  $ Hash#reverse_deep_merge(DeeplyEnumerable::Hash)
29
29
  $ Hash#reverse_deep_merge!(DeeplyEnumerable::Hash)
@@ -37,12 +37,12 @@ $ Array#deep_compact!
37
37
  ## Installation
38
38
  Add this line to your application's Gemfile:
39
39
  ```ruby
40
- gem 'deeply_enumerable'
40
+ gem "deeply_enumerable"
41
41
  ```
42
42
 
43
43
  or this line to extend the base `Enumerable` classes:
44
44
  ```ruby
45
- gem 'deeply_enumerable', require: 'base_extensions'
45
+ gem "deeply_enumerable", require: "base_extensions"
46
46
  ```
47
47
 
48
48
  And then execute:
data/Rakefile CHANGED
@@ -1,17 +1,17 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require "bundler/setup"
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
5
  end
6
6
 
7
- require 'rdoc/task'
7
+ require "rdoc/task"
8
8
 
9
9
  RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'DeeplyEnumerable'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
10
+ rdoc.rdoc_dir = "rdoc"
11
+ rdoc.title = "DeeplyEnumerable"
12
+ rdoc.options << "--line-numbers"
13
+ rdoc.rdoc_files.include("README.md")
14
+ rdoc.rdoc_files.include("lib/**/*.rb")
15
15
  end
16
16
 
17
17
 
@@ -19,13 +19,13 @@ end
19
19
 
20
20
 
21
21
 
22
- require 'bundler/gem_tasks'
22
+ require "bundler/gem_tasks"
23
23
 
24
- require 'rake/testtask'
24
+ require "rake/testtask"
25
25
 
26
26
  Rake::TestTask.new(:test) do |t|
27
- t.libs << 'test'
28
- t.pattern = 'test/**/*_test.rb'
27
+ t.libs << "test"
28
+ t.pattern = "test/**/*_test.rb"
29
29
  t.verbose = false
30
30
  end
31
31
 
@@ -1,4 +1,4 @@
1
- require 'deeply_enumerable'
1
+ require "deeply_enumerable"
2
2
 
3
3
  Hash.send(:include, DeeplyEnumerable::HashExtension)
4
4
  Array.send(:include, DeeplyEnumerable::ArrayExtension)
@@ -1,8 +1,8 @@
1
- require_relative 'enumerable'
1
+ require_relative "enumerable"
2
2
 
3
3
  module DeeplyEnumerable
4
- module ArrayExtensionklass
5
- def self.included
4
+ module ArrayExtension
5
+ def self.included klass
6
6
  klass.class_eval do
7
7
  include DeeplyEnumerable::Enumerable
8
8
  end
@@ -1,6 +1,6 @@
1
1
  module DeeplyEnumerable
2
2
  module Enumerable
3
- UNENUMERABLE = ['ActiveRecord::Relation']
3
+ UNENUMERABLE = ["ActiveRecord::Relation", "Range"]
4
4
 
5
5
  def self.included(klass)
6
6
  klass.extend(ClassMethods)
@@ -29,12 +29,12 @@ module DeeplyEnumerable
29
29
  deep_rebuild(object).deep_compact(remove_emptied_elements, remove_empty_elements)
30
30
  end
31
31
 
32
- private
33
-
34
32
  def unenumerable
35
- @unenumerable ||= UNENUMERABLE.map(&:safe_constantize).compact
33
+ @unenumerable ||= UNENUMERABLE.map { |unenumerable| unenumerable.constantize rescue nil }.compact
36
34
  end
37
35
 
36
+ private
37
+
38
38
  def check_object_class(object)
39
39
  raise TypeError, "object must be a #{superclass.name}" unless object.kind_of?(superclass)
40
40
  end
@@ -45,7 +45,7 @@ module DeeplyEnumerable
45
45
  end
46
46
 
47
47
  def unenumerable_object?(object)
48
- next if self.class.unenumerable.any? { |unenumerable_klass| object.is_a?(unenumerable_klass) }
48
+ self.class.unenumerable.any? { |unenumerable_klass| object.is_a?(unenumerable_klass) }
49
49
  end
50
50
  end
51
51
  end
@@ -1,4 +1,4 @@
1
- require_relative 'enumerable'
1
+ require_relative "enumerable"
2
2
 
3
3
  module DeeplyEnumerable
4
4
  module HashExtension
@@ -37,8 +37,7 @@ module DeeplyEnumerable
37
37
  compact_method = %i[deep_compact! deep_compact compact! compact].detect{ |m| value.respond_to?(m) }
38
38
  next unless compact_method
39
39
 
40
- original_empty = value.respond_to?(:empty?) ? value.empty? : value.respond_to?(:none?) ? value.none? : false
41
- debugger
40
+ original_empty = value.respond_to?(:empty?) ? value.empty? : value.respond_to?(:none?) ? value.none? : false rescue false
42
41
  compact_value = value.send(*[compact_method].concat(value.method(compact_method).parameters.collect { |_,param| binding.local_variable_get(param) } ).compact) || value
43
42
  compact_empty = compact_value.respond_to?(:empty?) ? compact_value.empty? : compact_value.respond_to?(:none?) ? compact_value.none? : false
44
43
 
@@ -1,3 +1,3 @@
1
1
  module DeeplyEnumerable
2
- VERSION = '0.9.2'
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,2 +1,2 @@
1
- require 'deeply_enumerable/array'
2
- require 'deeply_enumerable/hash'
1
+ require "deeply_enumerable/array"
2
+ require "deeply_enumerable/hash"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deeply_enumerable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - chaunce
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-28 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -44,7 +44,7 @@ homepage: https://github.com/chaunce/deeply_enumerable
44
44
  licenses:
45
45
  - MIT
46
46
  metadata: {}
47
- post_install_message:
47
+ post_install_message:
48
48
  rdoc_options: []
49
49
  require_paths:
50
50
  - lib
@@ -59,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
- rubygems_version: 3.0.6
63
- signing_key:
62
+ rubygems_version: 3.4.3
63
+ signing_key:
64
64
  specification_version: 4
65
65
  summary: recusrive support for enumerable operations
66
66
  test_files: []