nrser 0.0.30 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nrser.rb +56 -12
  3. data/lib/nrser/collection.rb +4 -7
  4. data/lib/nrser/ext.rb +5 -0
  5. data/lib/nrser/{refinements → ext}/enumerable.rb +11 -9
  6. data/lib/nrser/ext/pathname.rb +74 -0
  7. data/lib/nrser/{refinements → ext}/tree.rb +2 -26
  8. data/lib/nrser/functions.rb +18 -0
  9. data/lib/nrser/{array.rb → functions/array.rb} +2 -3
  10. data/lib/nrser/{binding.rb → functions/binding.rb} +0 -2
  11. data/lib/nrser/functions/enumerable.rb +355 -0
  12. data/lib/nrser/functions/enumerable/find_all_map.rb +33 -0
  13. data/lib/nrser/functions/enumerable/find_map.rb +53 -0
  14. data/lib/nrser/functions/exception.rb +17 -0
  15. data/lib/nrser/{hash.rb → functions/hash.rb} +0 -0
  16. data/lib/nrser/functions/hash/bury.rb +147 -0
  17. data/lib/nrser/{hash → functions/hash}/deep_merge.rb +5 -5
  18. data/lib/nrser/{hash → functions/hash}/except_keys.rb +2 -0
  19. data/lib/nrser/{hash → functions/hash}/guess_label_key_type.rb +3 -1
  20. data/lib/nrser/{hash → functions/hash}/slice_keys.rb +3 -1
  21. data/lib/nrser/{hash → functions/hash}/stringify_keys.rb +2 -0
  22. data/lib/nrser/{hash → functions/hash}/symbolize_keys.rb +3 -1
  23. data/lib/nrser/{hash → functions/hash}/transform_keys.rb +3 -1
  24. data/lib/nrser/functions/merge_by.rb +29 -0
  25. data/lib/nrser/{object.rb → functions/object.rb} +0 -0
  26. data/lib/nrser/{object → functions/object}/as_array.rb +2 -0
  27. data/lib/nrser/{object → functions/object}/as_hash.rb +7 -5
  28. data/lib/nrser/{object → functions/object}/truthy.rb +46 -7
  29. data/lib/nrser/{open_struct.rb → functions/open_struct.rb} +0 -0
  30. data/lib/nrser/functions/path.rb +150 -0
  31. data/lib/nrser/{proc.rb → functions/proc.rb} +1 -22
  32. data/lib/nrser/functions/string.rb +297 -0
  33. data/lib/nrser/functions/string/looks_like.rb +44 -0
  34. data/lib/nrser/{text.rb → functions/text.rb} +0 -0
  35. data/lib/nrser/{text → functions/text}/indentation.rb +2 -16
  36. data/lib/nrser/{text → functions/text}/lines.rb +1 -2
  37. data/lib/nrser/{text → functions/text}/word_wrap.rb +2 -4
  38. data/lib/nrser/{tree.rb → functions/tree.rb} +0 -0
  39. data/lib/nrser/{tree → functions/tree}/each_branch.rb +6 -7
  40. data/lib/nrser/functions/tree/leaves.rb +92 -0
  41. data/lib/nrser/{tree → functions/tree}/map_branches.rb +31 -32
  42. data/lib/nrser/functions/tree/map_leaves.rb +56 -0
  43. data/lib/nrser/{tree → functions/tree}/map_tree.rb +9 -20
  44. data/lib/nrser/{tree → functions/tree}/transform.rb +0 -10
  45. data/lib/nrser/logger.rb +9 -10
  46. data/lib/nrser/message.rb +3 -7
  47. data/lib/nrser/meta.rb +2 -0
  48. data/lib/nrser/meta/class_attrs.rb +3 -9
  49. data/lib/nrser/meta/props.rb +19 -19
  50. data/lib/nrser/meta/props/base.rb +4 -10
  51. data/lib/nrser/meta/props/prop.rb +12 -28
  52. data/lib/nrser/no_arg.rb +1 -3
  53. data/lib/nrser/refinements.rb +5 -0
  54. data/lib/nrser/refinements/array.rb +5 -17
  55. data/lib/nrser/refinements/enumerator.rb +1 -3
  56. data/lib/nrser/refinements/hash.rb +3 -15
  57. data/lib/nrser/refinements/object.rb +2 -2
  58. data/lib/nrser/refinements/open_struct.rb +0 -2
  59. data/lib/nrser/refinements/pathname.rb +3 -46
  60. data/lib/nrser/refinements/set.rb +2 -6
  61. data/lib/nrser/refinements/string.rb +2 -2
  62. data/lib/nrser/rspex.rb +16 -13
  63. data/lib/nrser/types.rb +6 -20
  64. data/lib/nrser/types/any.rb +0 -1
  65. data/lib/nrser/types/booleans.rb +1 -1
  66. data/lib/nrser/types/combinators.rb +5 -5
  67. data/lib/nrser/types/in.rb +0 -21
  68. data/lib/nrser/types/responds.rb +1 -0
  69. data/lib/nrser/types/trees.rb +1 -0
  70. data/lib/nrser/version.rb +2 -3
  71. data/spec/nrser/{template_spec.rb → functions/binding/template_spec.rb} +0 -0
  72. data/spec/nrser/functions/enumerable/find_all_map_spec.rb +28 -0
  73. data/spec/nrser/functions/enumerable/find_bounded_spec.rb +70 -0
  74. data/spec/nrser/functions/enumerable/find_map_spec.rb +38 -0
  75. data/spec/nrser/functions/enumerable/find_only_spec.rb +25 -0
  76. data/spec/nrser/functions/enumerable/to_h_by_spec.rb +28 -0
  77. data/spec/nrser/{format_exception_spec.rb → functions/exception/format_exception_spec.rb} +0 -0
  78. data/spec/nrser/{hash → functions/hash}/bury_spec.rb +0 -0
  79. data/spec/nrser/{hash → functions/hash}/guess_label_key_type_spec.rb +0 -0
  80. data/spec/nrser/{hash_spec.rb → functions/hash_spec.rb} +0 -7
  81. data/spec/nrser/{merge_by_spec.rb → functions/merge_by_spec.rb} +0 -0
  82. data/spec/nrser/{truthy_spec.rb → functions/object/truthy_spec.rb} +0 -0
  83. data/spec/nrser/{open_struct_spec.rb → functions/open_struct_spec.rb} +0 -0
  84. data/spec/nrser/{string → functions/string}/common_prefix_spec.rb +0 -0
  85. data/spec/nrser/{string → functions/string}/looks_like_spec.rb +0 -0
  86. data/spec/nrser/{truncate_spec.rb → functions/string/truncate_spec.rb} +0 -0
  87. data/spec/nrser/{text → functions/text}/dedent/gotchas_spec.rb +0 -0
  88. data/spec/nrser/{text → functions/text}/dedent_spec.rb +0 -0
  89. data/spec/nrser/{indent_spec.rb → functions/text/indent_spec.rb} +0 -0
  90. data/spec/nrser/{tree → functions/tree}/each_branch_spec.rb +0 -0
  91. data/spec/nrser/{tree → functions/tree}/leaves_spec.rb +0 -0
  92. data/spec/nrser/{tree → functions/tree}/map_branch_spec.rb +0 -0
  93. data/spec/nrser/{tree → functions/tree}/map_tree_spec.rb +0 -0
  94. data/spec/nrser/{tree → functions/tree}/transform_spec.rb +0 -0
  95. data/spec/nrser/{tree → functions/tree}/transformer_spec.rb +0 -0
  96. data/spec/nrser/meta/class_attrs_spec.rb +12 -14
  97. data/spec/spec_helper.rb +2 -3
  98. metadata +136 -110
  99. data/lib/nrser/enumerable.rb +0 -288
  100. data/lib/nrser/exception.rb +0 -7
  101. data/lib/nrser/hash/bury.rb +0 -154
  102. data/lib/nrser/merge_by.rb +0 -26
  103. data/lib/nrser/string.rb +0 -294
  104. data/lib/nrser/string/looks_like.rb +0 -51
  105. data/lib/nrser/tree/leaves.rb +0 -92
  106. data/lib/nrser/tree/map_leaves.rb +0 -63
  107. data/spec/nrser/enumerable_spec.rb +0 -111
@@ -0,0 +1,70 @@
1
+ describe_spec_file(
2
+ spec_path: __FILE__,
3
+ module: NRSER,
4
+ method: :find_bounded,
5
+ ) do
6
+
7
+ context "when just :length bounds arg is provided" do
8
+ it "returns found elements when length is correct" do
9
+ expect(
10
+ subject.([1, 2, 3], length: 1) { |i| i == 2 }
11
+ ).to eq [2]
12
+ end
13
+
14
+ it "raises TypeError when length in incorrect" do
15
+ expect {
16
+ subject.([1, 2, 3], length: 2) { |i| i == 2 }
17
+ }.to raise_error TypeError
18
+ end
19
+ end # when just :length bounds arg is provided
20
+
21
+ context "when just :min bounds arg is provided" do
22
+ it "returns found elements when min is correct" do
23
+ expect(
24
+ subject.([1, 2, 3], min: 1) { |i| i == 2 }
25
+ ).to eq [2]
26
+ end
27
+
28
+ it "raises TypeError when min in incorrect" do
29
+ expect {
30
+ subject.([1, 2, 3], min: 2) { |i| i == 2 }
31
+ }.to raise_error TypeError
32
+ end
33
+ end # when just :min bounds arg is provided
34
+
35
+ context "when just :max bounds arg is provided" do
36
+ it "returns found elements when max is correct" do
37
+ expect(
38
+ subject.([1, 2, 3], max: 2) { |i| i >= 2 }
39
+ ).to eq [2, 3]
40
+ end
41
+
42
+ it "raises TypeError when max in incorrect" do
43
+ expect {
44
+ subject.([1, 2, 3], max: 1) { |i| i >= 2 }
45
+ }.to raise_error TypeError
46
+ end
47
+ end # when just :max bounds arg is provided
48
+
49
+
50
+ context "when :min and :max bounds args are both provided" do
51
+ it "returns found elements when min and max are correct" do
52
+ expect(
53
+ subject.([1, 2, 3], min: 1, max: 2) { |i| i >= 2 }
54
+ ).to eq [2, 3]
55
+ end
56
+
57
+ it "raises TypeError when min is incorrect" do
58
+ expect {
59
+ subject.([1, 2, 3], min: 1, max: 2) { |i| false }
60
+ }.to raise_error TypeError
61
+ end
62
+
63
+ it "raises TypeError when max is incorrect" do
64
+ expect {
65
+ subject.([1, 2, 3], min: 1, max: 2) { |i| true }
66
+ }.to raise_error TypeError
67
+ end
68
+ end # when :min and :max bounds args are both provided
69
+
70
+ end # spec file
@@ -0,0 +1,38 @@
1
+ describe_spec_file(
2
+ spec_path: __FILE__,
3
+ module: NRSER,
4
+ method: :find_map,
5
+ ) do
6
+
7
+ describe "when a result is found" do
8
+ it "should return the block result" do
9
+ expect(
10
+ subject.call( [1, 2, 3, 4] ) do |i|
11
+ if i.even?
12
+ "#{ i } is even!"
13
+ end
14
+ end
15
+ ).to eq "2 is even!"
16
+ end
17
+ end
18
+
19
+
20
+ describe "when block returns `false`" do
21
+ it "should not be considered 'found'" do
22
+ expect(
23
+ subject.call( [1, 2, 3] ) { |i| false }
24
+ ).to be nil
25
+ end
26
+ end
27
+
28
+
29
+ describe "when none found and `ifnone` provided" do
30
+ it "should call `ifnone` and return the response" do
31
+ expect(
32
+ subject.call( [], ->(){ 'blah' } ) { |i| false }
33
+ ).to eq 'blah'
34
+ end
35
+ end # "when none found and `ifnone` provided"
36
+
37
+
38
+ end
@@ -0,0 +1,25 @@
1
+ describe_spec_file(
2
+ spec_path: __FILE__,
3
+ module: NRSER,
4
+ method: :find_only,
5
+ ) do
6
+
7
+ it "returns the element when only one is found" do
8
+ expect(
9
+ subject.call [1, 2, 3] { |i| i == 2 }
10
+ ).to be 2
11
+ end
12
+
13
+ it "raises TypeError when more than one element is found" do
14
+ expect {
15
+ subject.call [1, 2, 3] { |i| i >= 2 }
16
+ }.to raise_error TypeError
17
+ end
18
+
19
+ it "raises TypeError when no elements are found" do
20
+ expect {
21
+ subject.call [1, 2, 3] { |i| false }
22
+ }.to raise_error TypeError
23
+ end
24
+
25
+ end # spec file
@@ -0,0 +1,28 @@
1
+ describe_spec_file(
2
+ spec_path: __FILE__,
3
+ module: NRSER,
4
+ method: :to_h_by,
5
+ ) do
6
+
7
+ describe "when map does not result in duplicate keys" do
8
+ it "should succeed" do
9
+ expect(
10
+ subject.call %w{a b c}, &:ord
11
+ ).to eq({
12
+ 97 => 'a',
13
+ 98 => 'b',
14
+ 99 => 'c',
15
+ })
16
+ end
17
+ end #
18
+
19
+
20
+ describe "when map results in duplicate keys" do
21
+ it "should raise NRSER::ConflictError" do
22
+ expect {
23
+ subject.call( [1, 2, 3] ) { |i| i % 2 }
24
+ }.to raise_error NRSER::ConflictError
25
+ end
26
+ end # Duplicate keys
27
+
28
+ end # spec file
File without changes
@@ -1,11 +1,5 @@
1
- require 'set'
2
- require 'ostruct'
3
-
4
- require 'spec_helper'
5
-
6
1
  using NRSER
7
2
 
8
-
9
3
  describe NRSER.method(:map_values) do
10
4
 
11
5
  it "handles hashes" do
@@ -45,4 +39,3 @@ describe NRSER.method(:map_values) do
45
39
 
46
40
 
47
41
  end # NRSER.map_values
48
-
File without changes
File without changes
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe NRSER::Meta::ClassAttrs do
4
2
  # I'm writing this as I'm developing the module, so I'm going to walk through
5
3
  # some of the motivation, features and differences from other approaches
@@ -13,7 +11,7 @@ describe NRSER::Meta::ClassAttrs do
13
11
  # Because any changes would global and RSpec seems to do things some-what
14
12
  # asynchronously we need to use dynamic class creation, which is sub-optimal
15
13
  # because it has subtle difference with normal definitions (@@ variable
16
- # declaration being the major one I've hit do far), but it seems like the
14
+ # declaration being the major one I've hit do far), but it seems like the
17
15
  # most reasonable way to go about it at the moment.
18
16
  #
19
17
 
@@ -21,7 +19,7 @@ describe NRSER::Meta::ClassAttrs do
21
19
  Class.new do
22
20
  include NRSER::Meta::ClassAttrs
23
21
 
24
- # To compare, I'll also work with standard '@@' class variables and
22
+ # To compare, I'll also work with standard '@@' class variables and
25
23
  # an standard attr_accessors added to the classes themselves.
26
24
 
27
25
  # Normally this would be
@@ -43,7 +41,7 @@ describe NRSER::Meta::ClassAttrs do
43
41
  # I won't ever set this
44
42
  class_attr_accessor :never_set
45
43
 
46
- # I'll define this here, but won't set it from base
44
+ # I'll define this here, but won't set it from base
47
45
  class_attr_accessor :def_in_base
48
46
 
49
47
  # These will be set from here
@@ -88,7 +86,7 @@ describe NRSER::Meta::ClassAttrs do
88
86
  end
89
87
  }
90
88
 
91
- let(:child_2) {
89
+ let(:child_2) {
92
90
  Class.new(base) do
93
91
  end
94
92
  }
@@ -109,7 +107,7 @@ describe NRSER::Meta::ClassAttrs do
109
107
  # don't (PROBLEM! examples) for class (@@) variables.
110
108
  #
111
109
 
112
- it "can access @@ variables from base and any subclass (OK)" do
110
+ it "can access @@ variables from base and any subclass (OK)" do
113
111
  [base, child_1, child_1_1, child_2, child_2_1].each do |klass|
114
112
  expect(
115
113
  klass.class_variable_get :@@base_class_var
@@ -125,7 +123,7 @@ describe NRSER::Meta::ClassAttrs do
125
123
  base.class_variable_set :@@base_class_var, new_value
126
124
  }
127
125
 
128
- it "can access new value from base and any subclass (OK)" do
126
+ it "can access new value from base and any subclass (OK)" do
129
127
  [base, child_1, child_1_1, child_2, child_2_1].each do |klass|
130
128
  expect(
131
129
  klass.class_variable_get :@@base_class_var
@@ -142,9 +140,9 @@ describe NRSER::Meta::ClassAttrs do
142
140
  child_1.class_variable_set :@@base_class_var, new_value
143
141
  }
144
142
 
145
- # This is the problem: changes to the value anywhere in the hierarchy
146
- # are global to the hierarchy
147
- it "reads that value from all classes (PROBLEM!)" do
143
+ # This is the problem: changes to the value anywhere in the hierarchy
144
+ # are global to the hierarchy
145
+ it "reads that value from all classes (PROBLEM!)" do
148
146
  [base, child_1, child_1_1, child_2, child_2_1].each do |klass|
149
147
  expect(
150
148
  klass.class_variable_get :@@base_class_var
@@ -204,7 +202,7 @@ describe NRSER::Meta::ClassAttrs do
204
202
  base.set_in_base_1 = new_value
205
203
  }
206
204
 
207
- it "can access new value from base and any subclass" do
205
+ it "can access new value from base and any subclass" do
208
206
  [base, child_1, child_1_1, child_2, child_2_1].each do |klass|
209
207
  expect(klass.set_in_base_1).to be new_value
210
208
  end
@@ -222,13 +220,13 @@ describe NRSER::Meta::ClassAttrs do
222
220
  child_1.set_in_base_1 = new_value
223
221
  }
224
222
 
225
- it "reads the new value from that class and any subclasses" do
223
+ it "reads the new value from that class and any subclasses" do
226
224
  [child_1, child_1_1].each do |klass|
227
225
  expect(klass.set_in_base_1).to be new_value
228
226
  end
229
227
  end
230
228
 
231
- it "reads the old value from any other classes" do
229
+ it "reads the old value from any other classes" do
232
230
  [base, child_2, child_2_1].each do |klass|
233
231
  expect(klass.set_in_base_1).to be :set_in_base_1_value
234
232
  end
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ require 'cmds'
3
3
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
4
 
5
5
  require 'nrser'
6
+
6
7
  require 'nrser/logger'
7
8
  require 'nrser/rspex'
8
9
 
@@ -116,7 +117,7 @@ shared_examples "make type" do | args: [],
116
117
  subject.from_s s
117
118
  }.to raise_error *NRSER.as_array( error )
118
119
  end # raises an error
119
- end #
120
+ end #
120
121
  }
121
122
  end # rejects
122
123
  end
@@ -126,5 +127,3 @@ shared_examples "make type" do | args: [],
126
127
 
127
128
  end # #call( ... )
128
129
  end # Type maker method
129
-
130
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nrser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-06 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,112 +16,124 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '1.16'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.16.1
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '1.5'
29
+ version: '1.16'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.16.1
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: '12.3'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: '12.3'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rspec
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ">="
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: '3.7'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: '3.7'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: yard
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - ">="
65
+ - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0'
67
+ version: 0.9.12
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - ">="
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0'
74
+ version: 0.9.12
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: redcarpet
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - ">="
79
+ - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0'
81
+ version: '3.4'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - ">="
86
+ - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0'
88
+ version: '3.4'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: github-markup
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - ">="
93
+ - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '0'
95
+ version: '1.6'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - ">="
100
+ - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '0'
102
+ version: '1.6'
97
103
  - !ruby/object:Gem::Dependency
98
- name: cmds
104
+ name: pry
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
- - - ">="
107
+ - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '0'
109
+ version: 0.10.4
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
- - - ">="
114
+ - - "~>"
109
115
  - !ruby/object:Gem::Version
110
- version: '0'
116
+ version: 0.10.4
111
117
  - !ruby/object:Gem::Dependency
112
- name: pry
118
+ name: cmds
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.0'
115
124
  - - ">="
116
125
  - !ruby/object:Gem::Version
117
- version: '0'
126
+ version: 0.2.4
118
127
  type: :development
119
128
  prerelease: false
120
129
  version_requirements: !ruby/object:Gem::Requirement
121
130
  requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '0.0'
122
134
  - - ">="
123
135
  - !ruby/object:Gem::Version
124
- version: '0'
136
+ version: 0.2.4
125
137
  description:
126
138
  email:
127
139
  - neil@neilsouza.com
@@ -132,23 +144,50 @@ files:
132
144
  - LICENSE.txt
133
145
  - README.md
134
146
  - lib/nrser.rb
135
- - lib/nrser/array.rb
136
- - lib/nrser/binding.rb
137
147
  - lib/nrser/collection.rb
138
- - lib/nrser/enumerable.rb
139
148
  - lib/nrser/errors.rb
140
- - lib/nrser/exception.rb
141
- - lib/nrser/hash.rb
142
- - lib/nrser/hash/bury.rb
143
- - lib/nrser/hash/deep_merge.rb
144
- - lib/nrser/hash/except_keys.rb
145
- - lib/nrser/hash/guess_label_key_type.rb
146
- - lib/nrser/hash/slice_keys.rb
147
- - lib/nrser/hash/stringify_keys.rb
148
- - lib/nrser/hash/symbolize_keys.rb
149
- - lib/nrser/hash/transform_keys.rb
149
+ - lib/nrser/ext.rb
150
+ - lib/nrser/ext/enumerable.rb
151
+ - lib/nrser/ext/pathname.rb
152
+ - lib/nrser/ext/tree.rb
153
+ - lib/nrser/functions.rb
154
+ - lib/nrser/functions/array.rb
155
+ - lib/nrser/functions/binding.rb
156
+ - lib/nrser/functions/enumerable.rb
157
+ - lib/nrser/functions/enumerable/find_all_map.rb
158
+ - lib/nrser/functions/enumerable/find_map.rb
159
+ - lib/nrser/functions/exception.rb
160
+ - lib/nrser/functions/hash.rb
161
+ - lib/nrser/functions/hash/bury.rb
162
+ - lib/nrser/functions/hash/deep_merge.rb
163
+ - lib/nrser/functions/hash/except_keys.rb
164
+ - lib/nrser/functions/hash/guess_label_key_type.rb
165
+ - lib/nrser/functions/hash/slice_keys.rb
166
+ - lib/nrser/functions/hash/stringify_keys.rb
167
+ - lib/nrser/functions/hash/symbolize_keys.rb
168
+ - lib/nrser/functions/hash/transform_keys.rb
169
+ - lib/nrser/functions/merge_by.rb
170
+ - lib/nrser/functions/object.rb
171
+ - lib/nrser/functions/object/as_array.rb
172
+ - lib/nrser/functions/object/as_hash.rb
173
+ - lib/nrser/functions/object/truthy.rb
174
+ - lib/nrser/functions/open_struct.rb
175
+ - lib/nrser/functions/path.rb
176
+ - lib/nrser/functions/proc.rb
177
+ - lib/nrser/functions/string.rb
178
+ - lib/nrser/functions/string/looks_like.rb
179
+ - lib/nrser/functions/text.rb
180
+ - lib/nrser/functions/text/indentation.rb
181
+ - lib/nrser/functions/text/lines.rb
182
+ - lib/nrser/functions/text/word_wrap.rb
183
+ - lib/nrser/functions/tree.rb
184
+ - lib/nrser/functions/tree/each_branch.rb
185
+ - lib/nrser/functions/tree/leaves.rb
186
+ - lib/nrser/functions/tree/map_branches.rb
187
+ - lib/nrser/functions/tree/map_leaves.rb
188
+ - lib/nrser/functions/tree/map_tree.rb
189
+ - lib/nrser/functions/tree/transform.rb
150
190
  - lib/nrser/logger.rb
151
- - lib/nrser/merge_by.rb
152
191
  - lib/nrser/message.rb
153
192
  - lib/nrser/meta.rb
154
193
  - lib/nrser/meta/class_attrs.rb
@@ -156,16 +195,9 @@ files:
156
195
  - lib/nrser/meta/props/base.rb
157
196
  - lib/nrser/meta/props/prop.rb
158
197
  - lib/nrser/no_arg.rb
159
- - lib/nrser/object.rb
160
- - lib/nrser/object/as_array.rb
161
- - lib/nrser/object/as_hash.rb
162
- - lib/nrser/object/truthy.rb
163
- - lib/nrser/open_struct.rb
164
- - lib/nrser/proc.rb
165
198
  - lib/nrser/refinements.rb
166
199
  - lib/nrser/refinements/array.rb
167
200
  - lib/nrser/refinements/binding.rb
168
- - lib/nrser/refinements/enumerable.rb
169
201
  - lib/nrser/refinements/enumerator.rb
170
202
  - lib/nrser/refinements/exception.rb
171
203
  - lib/nrser/refinements/hash.rb
@@ -175,25 +207,11 @@ files:
175
207
  - lib/nrser/refinements/set.rb
176
208
  - lib/nrser/refinements/string.rb
177
209
  - lib/nrser/refinements/symbol.rb
178
- - lib/nrser/refinements/tree.rb
179
210
  - lib/nrser/refinements/types.rb
180
211
  - lib/nrser/rspex.rb
181
212
  - lib/nrser/rspex/shared_examples.rb
182
- - lib/nrser/string.rb
183
- - lib/nrser/string/looks_like.rb
184
213
  - lib/nrser/temp/unicode_math.rb
185
214
  - lib/nrser/temp/where.rb
186
- - lib/nrser/text.rb
187
- - lib/nrser/text/indentation.rb
188
- - lib/nrser/text/lines.rb
189
- - lib/nrser/text/word_wrap.rb
190
- - lib/nrser/tree.rb
191
- - lib/nrser/tree/each_branch.rb
192
- - lib/nrser/tree/leaves.rb
193
- - lib/nrser/tree/map_branches.rb
194
- - lib/nrser/tree/map_leaves.rb
195
- - lib/nrser/tree/map_tree.rb
196
- - lib/nrser/tree/transform.rb
197
215
  - lib/nrser/types.rb
198
216
  - lib/nrser/types/any.rb
199
217
  - lib/nrser/types/array.rb
@@ -221,13 +239,32 @@ files:
221
239
  - lib/nrser/version.rb
222
240
  - spec/nrser/collection/each_spec.rb
223
241
  - spec/nrser/collection/map_spec.rb
224
- - spec/nrser/enumerable_spec.rb
225
242
  - spec/nrser/errors/abstract_method_error_spec.rb
226
- - spec/nrser/format_exception_spec.rb
227
- - spec/nrser/hash/bury_spec.rb
228
- - spec/nrser/hash/guess_label_key_type_spec.rb
229
- - spec/nrser/hash_spec.rb
230
- - spec/nrser/indent_spec.rb
243
+ - spec/nrser/functions/binding/template_spec.rb
244
+ - spec/nrser/functions/enumerable/find_all_map_spec.rb
245
+ - spec/nrser/functions/enumerable/find_bounded_spec.rb
246
+ - spec/nrser/functions/enumerable/find_map_spec.rb
247
+ - spec/nrser/functions/enumerable/find_only_spec.rb
248
+ - spec/nrser/functions/enumerable/to_h_by_spec.rb
249
+ - spec/nrser/functions/exception/format_exception_spec.rb
250
+ - spec/nrser/functions/hash/bury_spec.rb
251
+ - spec/nrser/functions/hash/guess_label_key_type_spec.rb
252
+ - spec/nrser/functions/hash_spec.rb
253
+ - spec/nrser/functions/merge_by_spec.rb
254
+ - spec/nrser/functions/object/truthy_spec.rb
255
+ - spec/nrser/functions/open_struct_spec.rb
256
+ - spec/nrser/functions/string/common_prefix_spec.rb
257
+ - spec/nrser/functions/string/looks_like_spec.rb
258
+ - spec/nrser/functions/string/truncate_spec.rb
259
+ - spec/nrser/functions/text/dedent/gotchas_spec.rb
260
+ - spec/nrser/functions/text/dedent_spec.rb
261
+ - spec/nrser/functions/text/indent_spec.rb
262
+ - spec/nrser/functions/tree/each_branch_spec.rb
263
+ - spec/nrser/functions/tree/leaves_spec.rb
264
+ - spec/nrser/functions/tree/map_branch_spec.rb
265
+ - spec/nrser/functions/tree/map_tree_spec.rb
266
+ - spec/nrser/functions/tree/transform_spec.rb
267
+ - spec/nrser/functions/tree/transformer_spec.rb
231
268
  - spec/nrser/logger/dest_spec.rb
232
269
  - spec/nrser/logger/die_spec.rb
233
270
  - spec/nrser/logger/install_spec.rb
@@ -236,12 +273,10 @@ files:
236
273
  - spec/nrser/logger/level_sym_spec.rb
237
274
  - spec/nrser/logger/send_log_spec.rb
238
275
  - spec/nrser/logger/use_spec.rb
239
- - spec/nrser/merge_by_spec.rb
240
276
  - spec/nrser/meta/class_attrs_spec.rb
241
277
  - spec/nrser/meta/props/to_and_from_data_spec.rb
242
278
  - spec/nrser/meta/props_spec.rb
243
279
  - spec/nrser/op/message_spec.rb
244
- - spec/nrser/open_struct_spec.rb
245
280
  - spec/nrser/refinements/array_spec.rb
246
281
  - spec/nrser/refinements/erb_spec.rb
247
282
  - spec/nrser/refinements/format_exception_spec.rb
@@ -251,19 +286,6 @@ files:
251
286
  - spec/nrser/refinements/pathname_spec.rb
252
287
  - spec/nrser/refinements/set_spec.rb
253
288
  - spec/nrser/refinements/truncate_spec.rb
254
- - spec/nrser/string/common_prefix_spec.rb
255
- - spec/nrser/string/looks_like_spec.rb
256
- - spec/nrser/template_spec.rb
257
- - spec/nrser/text/dedent/gotchas_spec.rb
258
- - spec/nrser/text/dedent_spec.rb
259
- - spec/nrser/tree/each_branch_spec.rb
260
- - spec/nrser/tree/leaves_spec.rb
261
- - spec/nrser/tree/map_branch_spec.rb
262
- - spec/nrser/tree/map_tree_spec.rb
263
- - spec/nrser/tree/transform_spec.rb
264
- - spec/nrser/tree/transformer_spec.rb
265
- - spec/nrser/truncate_spec.rb
266
- - spec/nrser/truthy_spec.rb
267
289
  - spec/nrser/types/array_spec.rb
268
290
  - spec/nrser/types/attrs_spec.rb
269
291
  - spec/nrser/types/combinators_spec.rb
@@ -288,7 +310,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
310
  requirements:
289
311
  - - ">="
290
312
  - !ruby/object:Gem::Version
291
- version: '0'
313
+ version: 2.3.0
292
314
  required_rubygems_version: !ruby/object:Gem::Requirement
293
315
  requirements:
294
316
  - - ">="
@@ -303,13 +325,32 @@ summary: basic ruby utils i use in a lot of stuff.
303
325
  test_files:
304
326
  - spec/nrser/collection/each_spec.rb
305
327
  - spec/nrser/collection/map_spec.rb
306
- - spec/nrser/enumerable_spec.rb
307
328
  - spec/nrser/errors/abstract_method_error_spec.rb
308
- - spec/nrser/format_exception_spec.rb
309
- - spec/nrser/hash/bury_spec.rb
310
- - spec/nrser/hash/guess_label_key_type_spec.rb
311
- - spec/nrser/hash_spec.rb
312
- - spec/nrser/indent_spec.rb
329
+ - spec/nrser/functions/binding/template_spec.rb
330
+ - spec/nrser/functions/enumerable/find_all_map_spec.rb
331
+ - spec/nrser/functions/enumerable/find_bounded_spec.rb
332
+ - spec/nrser/functions/enumerable/find_map_spec.rb
333
+ - spec/nrser/functions/enumerable/find_only_spec.rb
334
+ - spec/nrser/functions/enumerable/to_h_by_spec.rb
335
+ - spec/nrser/functions/exception/format_exception_spec.rb
336
+ - spec/nrser/functions/hash/bury_spec.rb
337
+ - spec/nrser/functions/hash/guess_label_key_type_spec.rb
338
+ - spec/nrser/functions/hash_spec.rb
339
+ - spec/nrser/functions/merge_by_spec.rb
340
+ - spec/nrser/functions/object/truthy_spec.rb
341
+ - spec/nrser/functions/open_struct_spec.rb
342
+ - spec/nrser/functions/string/common_prefix_spec.rb
343
+ - spec/nrser/functions/string/looks_like_spec.rb
344
+ - spec/nrser/functions/string/truncate_spec.rb
345
+ - spec/nrser/functions/text/dedent/gotchas_spec.rb
346
+ - spec/nrser/functions/text/dedent_spec.rb
347
+ - spec/nrser/functions/text/indent_spec.rb
348
+ - spec/nrser/functions/tree/each_branch_spec.rb
349
+ - spec/nrser/functions/tree/leaves_spec.rb
350
+ - spec/nrser/functions/tree/map_branch_spec.rb
351
+ - spec/nrser/functions/tree/map_tree_spec.rb
352
+ - spec/nrser/functions/tree/transform_spec.rb
353
+ - spec/nrser/functions/tree/transformer_spec.rb
313
354
  - spec/nrser/logger/dest_spec.rb
314
355
  - spec/nrser/logger/die_spec.rb
315
356
  - spec/nrser/logger/install_spec.rb
@@ -318,12 +359,10 @@ test_files:
318
359
  - spec/nrser/logger/level_sym_spec.rb
319
360
  - spec/nrser/logger/send_log_spec.rb
320
361
  - spec/nrser/logger/use_spec.rb
321
- - spec/nrser/merge_by_spec.rb
322
362
  - spec/nrser/meta/class_attrs_spec.rb
323
363
  - spec/nrser/meta/props/to_and_from_data_spec.rb
324
364
  - spec/nrser/meta/props_spec.rb
325
365
  - spec/nrser/op/message_spec.rb
326
- - spec/nrser/open_struct_spec.rb
327
366
  - spec/nrser/refinements/array_spec.rb
328
367
  - spec/nrser/refinements/erb_spec.rb
329
368
  - spec/nrser/refinements/format_exception_spec.rb
@@ -333,19 +372,6 @@ test_files:
333
372
  - spec/nrser/refinements/pathname_spec.rb
334
373
  - spec/nrser/refinements/set_spec.rb
335
374
  - spec/nrser/refinements/truncate_spec.rb
336
- - spec/nrser/string/common_prefix_spec.rb
337
- - spec/nrser/string/looks_like_spec.rb
338
- - spec/nrser/template_spec.rb
339
- - spec/nrser/text/dedent/gotchas_spec.rb
340
- - spec/nrser/text/dedent_spec.rb
341
- - spec/nrser/tree/each_branch_spec.rb
342
- - spec/nrser/tree/leaves_spec.rb
343
- - spec/nrser/tree/map_branch_spec.rb
344
- - spec/nrser/tree/map_tree_spec.rb
345
- - spec/nrser/tree/transform_spec.rb
346
- - spec/nrser/tree/transformer_spec.rb
347
- - spec/nrser/truncate_spec.rb
348
- - spec/nrser/truthy_spec.rb
349
375
  - spec/nrser/types/array_spec.rb
350
376
  - spec/nrser/types/attrs_spec.rb
351
377
  - spec/nrser/types/combinators_spec.rb