trick_bag 0.42.0 → 0.43.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OWFkZGQzZWE1N2RmY2RhNTNiZmMyZTMyODEzNWRlYjkzNTcwNDNmOA==
5
- data.tar.gz: !binary |-
6
- MWVmNTRlYzRhOTA3MWY1YWZmNWYxN2EzM2FjZmVkZDM4OTNmYjQ5Zg==
2
+ SHA1:
3
+ metadata.gz: c31a98dc149bcc3e07095aa0dd04a3f65906a699
4
+ data.tar.gz: 7882b1eee6ee139d7457adab1ffbc57b2002e9da
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MTNjZjZlYzA3N2YyZDA1ZWNjODdiZWIwOThjNjk0MTkxMzljMDA4MGY1NTQ0
10
- NjBjMWVlNDkwOGU3ZjkzODdhZTE1NTc2NzNmYzIyMGQ4ZWFlNjkxOGU4YmJh
11
- NDIxZDk4NTUzNTAzZjc0MGEyNjhiOGMwYjJmY2Y5ZWZkMjFjOGY=
12
- data.tar.gz: !binary |-
13
- MGFhMDBjZWQ2MTVmNDIzYTY1YzY4ODE1ZjRiMzZlMWRmNWM2ZDg2OGQzMjgy
14
- ZGRhYWUyNDE0MGU2YzYxZTkxZDZiNDAzMGM0NDM2ZjNlNDRkMjIzY2UwNzU0
15
- OGIxODhmODA1MThkNzRiYjY0YWJkZWMwMmI3NTc3NDVmMDI1YmM=
6
+ metadata.gz: 2f51b81080fb07c921588cc7c969978e3af553aba82a665258feeae8c98b58d7fdfd8b9834204131ce33d2b4fd40b2fffdc7b66c47015b6854bff3903c2bbeb4
7
+ data.tar.gz: 98298c3991c08e9de73ee5aea69fd305cc2cb044424e26294279297860879cefc40455e0c14edeee356740d855c21486f5f7a0359295055ce5319a485e993975
data/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.43.0
2
+
3
+ * Added any?, all?, none?.
4
+
5
+
1
6
  ## v0.42.0
2
7
 
3
8
  * Added ErbRenderer class, which functions as a bag of values for ERB rendering.
@@ -31,7 +31,7 @@ class ErbRenderer < OpenStruct
31
31
 
32
32
  # Useful for seeing what values are stored in the OpenStruct.
33
33
  def keys
34
- @table.keys.clone
34
+ @table.keys
35
35
  end
36
36
  end
37
37
 
@@ -0,0 +1,25 @@
1
+ module TrickBag
2
+
3
+ module_function
4
+
5
+
6
+ # Returns whether or not none of the condition lambdas return true
7
+ # when passed the specified object
8
+ def none?(conditions, object)
9
+ conditions.none? { |condition| condition.(object) }
10
+ end
11
+
12
+
13
+ # Returns whether or not all of the condition lambdas return true
14
+ # when passed the specified object
15
+ def all?(conditions, object)
16
+ conditions.all? { |condition| condition.(object) }
17
+ end
18
+
19
+
20
+ # Returns whether or not any of the condition lambdas return true
21
+ # when passed the specified object
22
+ def any?(conditions, object)
23
+ conditions.any? { |condition| condition.(object) }
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module TrickBag
2
- VERSION = "0.42.0"
2
+ VERSION = "0.43.0"
3
3
  end
@@ -0,0 +1,68 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ require 'trick_bag/functional/functional'
4
+
5
+
6
+
7
+ module TrickBag
8
+
9
+ describe 'Composite predicates' do
10
+
11
+ false_func = ->(x) { false }
12
+ true_func = ->(x) { true }
13
+ all_true_funcs = [true_func] * 2
14
+ all_false_funcs = [false_func] * 2
15
+ mixed_true_false_funcs = [true_func, false_func]
16
+
17
+ context "none?" do
18
+
19
+ specify "returns true when all are false" do
20
+ expect(TrickBag.none?(all_false_funcs, 1)).to be_true
21
+ end
22
+
23
+ specify "returns false when all are true" do
24
+ expect(TrickBag.none?(all_true_funcs, 1)).to be_false
25
+ end
26
+
27
+ specify "returns false when some are false and some are true" do
28
+ expect(TrickBag.none?(mixed_true_false_funcs, 1)).to be_false
29
+ end
30
+ end
31
+
32
+
33
+ context "any?" do
34
+
35
+ specify "returns false when all are false" do
36
+ expect(TrickBag.any?(all_false_funcs, 1)).to be_false
37
+ end
38
+
39
+ specify "returns true when all are true" do
40
+ expect(TrickBag.any?(all_true_funcs, 1)).to be_true
41
+ end
42
+
43
+ specify "returns true when some are false and some are true" do
44
+ expect(TrickBag.any?(mixed_true_false_funcs, 1)).to be_true
45
+ end
46
+ end
47
+
48
+
49
+ context "all?" do
50
+
51
+ specify "returns false when all are false" do
52
+ expect(TrickBag.all?(all_false_funcs, 1)).to be_false
53
+ end
54
+
55
+ specify "returns true when all are true" do
56
+ expect(TrickBag.all?(all_true_funcs, 1)).to be_true
57
+ end
58
+
59
+ specify "returns false when some are false and some are true" do
60
+ expect(TrickBag.all?(mixed_true_false_funcs, 1)).to be_false
61
+ end
62
+ end
63
+
64
+
65
+
66
+ end
67
+
68
+ end
data/trick_bag.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = TrickBag::VERSION
9
9
  spec.authors = ["Keith Bennett"]
10
10
  spec.email = ["keithrbennett@gmail.com"]
11
- spec.description = %q{Miscellaneous general useful tools.}
12
- spec.summary = spec.description
11
+ spec.description = %q{Miscellaneous general useful tools for general purpose programming.}
12
+ spec.summary = %q{Miscellaneous general useful tools.}
13
13
  spec.homepage = "https://github.com/keithrbennett/trick_bag"
14
14
  spec.license = "MIT"
15
15
 
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "os"
21
+ spec.add_dependency "os", '~> 0'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "guard"
27
- spec.add_development_dependency "guard-rspec"
24
+ spec.add_development_dependency "rake", '~> 10'
25
+ spec.add_development_dependency "rspec", '~> 2'
26
+ spec.add_development_dependency "guard", '~> 2'
27
+ spec.add_development_dependency "guard-rspec", '~> 4'
28
28
  end
metadata CHANGED
@@ -1,100 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trick_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.0
4
+ version: 0.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bennett
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-12 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
20
+ requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
- - - ! '>='
22
+ - - ~>
25
23
  - !ruby/object:Gem::Version
26
24
  version: '0'
25
+ prerelease: false
26
+ type: :runtime
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
- requirement: !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
37
35
  requirements:
38
36
  - - ~>
39
37
  - !ruby/object:Gem::Version
40
38
  version: '1.3'
39
+ prerelease: false
40
+ type: :development
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '10'
43
48
  requirement: !ruby/object:Gem::Requirement
44
49
  requirements:
45
- - - ! '>='
50
+ - - ~>
46
51
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
52
+ version: '10'
49
53
  prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
50
57
  version_requirements: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - ~>
53
60
  - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
61
+ version: '2'
57
62
  requirement: !ruby/object:Gem::Requirement
58
63
  requirements:
59
- - - ! '>='
64
+ - - ~>
60
65
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
66
+ version: '2'
63
67
  prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
64
71
  version_requirements: !ruby/object:Gem::Requirement
65
72
  requirements:
66
- - - ! '>='
73
+ - - ~>
67
74
  - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: guard
75
+ version: '2'
71
76
  requirement: !ruby/object:Gem::Requirement
72
77
  requirements:
73
- - - ! '>='
78
+ - - ~>
74
79
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
80
+ version: '2'
77
81
  prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
78
85
  version_requirements: !ruby/object:Gem::Requirement
79
86
  requirements:
80
- - - ! '>='
87
+ - - ~>
81
88
  - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: guard-rspec
89
+ version: '4'
85
90
  requirement: !ruby/object:Gem::Requirement
86
91
  requirements:
87
- - - ! '>='
92
+ - - ~>
88
93
  - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
94
+ version: '4'
91
95
  prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ! '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- description: Miscellaneous general useful tools.
96
+ type: :development
97
+ description: Miscellaneous general useful tools for general purpose programming.
98
98
  email:
99
99
  - keithrbennett@gmail.com
100
100
  executables: []
@@ -118,6 +118,7 @@ files:
118
118
  - lib/trick_bag/enumerables/filtered_enumerable.rb
119
119
  - lib/trick_bag/formatters/erb_renderer.rb
120
120
  - lib/trick_bag/formatters/formatters.rb
121
+ - lib/trick_bag/functional/functional.rb
121
122
  - lib/trick_bag/io/temp_files.rb
122
123
  - lib/trick_bag/io/text_mode_status_updater.rb
123
124
  - lib/trick_bag/meta/classes.rb
@@ -141,6 +142,7 @@ files:
141
142
  - spec/trick_bag/enumerables/filtered_enumerable_spec.rb
142
143
  - spec/trick_bag/formatters/erb_renderer_spec.rb
143
144
  - spec/trick_bag/formatters/formatters_spec.rb
145
+ - spec/trick_bag/functional/functional_spec.rb
144
146
  - spec/trick_bag/io/temp_files_spec.rb
145
147
  - spec/trick_bag/io/text_mode_status_updater_spec.rb
146
148
  - spec/trick_bag/meta/classes_spec.rb
@@ -158,24 +160,24 @@ homepage: https://github.com/keithrbennett/trick_bag
158
160
  licenses:
159
161
  - MIT
160
162
  metadata: {}
161
- post_install_message:
163
+ post_install_message:
162
164
  rdoc_options: []
163
165
  require_paths:
164
166
  - lib
165
167
  required_ruby_version: !ruby/object:Gem::Requirement
166
168
  requirements:
167
- - - ! '>='
169
+ - - '>='
168
170
  - !ruby/object:Gem::Version
169
171
  version: '0'
170
172
  required_rubygems_version: !ruby/object:Gem::Requirement
171
173
  requirements:
172
- - - ! '>='
174
+ - - '>='
173
175
  - !ruby/object:Gem::Version
174
176
  version: '0'
175
177
  requirements: []
176
- rubyforge_project:
178
+ rubyforge_project:
177
179
  rubygems_version: 2.2.2
178
- signing_key:
180
+ signing_key:
179
181
  specification_version: 4
180
182
  summary: Miscellaneous general useful tools.
181
183
  test_files:
@@ -189,6 +191,7 @@ test_files:
189
191
  - spec/trick_bag/enumerables/filtered_enumerable_spec.rb
190
192
  - spec/trick_bag/formatters/erb_renderer_spec.rb
191
193
  - spec/trick_bag/formatters/formatters_spec.rb
194
+ - spec/trick_bag/functional/functional_spec.rb
192
195
  - spec/trick_bag/io/temp_files_spec.rb
193
196
  - spec/trick_bag/io/text_mode_status_updater_spec.rb
194
197
  - spec/trick_bag/meta/classes_spec.rb
@@ -201,4 +204,3 @@ test_files:
201
204
  - spec/trick_bag/validations/hashes_validations_spec.rb
202
205
  - spec/trick_bag/validations/object_validations_spec.rb
203
206
  - spec/trick_bag/validations/other_validations_spec.rb
204
- has_rdoc: