gorillib 0.1.11 → 0.4.0pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +1 -2
- data/.yardopts +9 -0
- data/{CHANGELOG.textile → CHANGELOG.md} +35 -9
- data/Gemfile +21 -14
- data/Guardfile +19 -0
- data/{LICENSE.textile → LICENSE.md} +43 -29
- data/README.md +47 -52
- data/Rakefile +31 -30
- data/TODO.md +32 -0
- data/VERSION +1 -1
- data/examples/builder/ironfan.rb +133 -0
- data/examples/model/simple.rb +17 -0
- data/gorillib.gemspec +106 -86
- data/lib/alt/kernel/call_stack.rb +56 -0
- data/lib/gorillib/array/wrap.rb +53 -0
- data/lib/gorillib/base.rb +3 -3
- data/lib/gorillib/builder/field.rb +5 -0
- data/lib/gorillib/builder.rb +260 -0
- data/lib/gorillib/collection/has_collection.rb +31 -0
- data/lib/gorillib/collection.rb +129 -0
- data/lib/gorillib/configurable.rb +28 -0
- data/lib/gorillib/datetime/{flat.rb → to_flat.rb} +0 -0
- data/lib/gorillib/exception/confidence.rb +17 -0
- data/lib/gorillib/exception/raisers.rb +78 -0
- data/lib/gorillib/hash/mash.rb +202 -0
- data/lib/gorillib/hashlike/slice.rb +53 -19
- data/lib/gorillib/hashlike.rb +5 -3
- data/lib/gorillib/io/system_helpers.rb +30 -0
- data/lib/gorillib/logger/log.rb +18 -0
- data/lib/gorillib/metaprogramming/concern.rb +124 -0
- data/lib/gorillib/model/active_model_conversion.rb +68 -0
- data/lib/gorillib/model/active_model_naming.rb +87 -0
- data/lib/gorillib/model/active_model_shim.rb +33 -0
- data/lib/gorillib/model/base.rb +341 -0
- data/lib/gorillib/model/defaults.rb +71 -0
- data/lib/gorillib/model/errors.rb +14 -0
- data/lib/gorillib/model/factories.rb +372 -0
- data/lib/gorillib/model/field.rb +146 -0
- data/lib/gorillib/model/named_schema.rb +53 -0
- data/lib/gorillib/{struct/hashlike_iteration.rb → model/overlay.rb} +0 -0
- data/lib/gorillib/model/record_schema.rb +9 -0
- data/lib/gorillib/model/serialization.rb +23 -0
- data/lib/gorillib/model/validate.rb +22 -0
- data/lib/gorillib/model.rb +23 -0
- data/lib/gorillib/pathname.rb +78 -0
- data/lib/gorillib/{serialization.rb → serialization/to_wire.rb} +0 -0
- data/lib/gorillib/some.rb +11 -9
- data/lib/gorillib/string/constantize.rb +21 -14
- data/lib/gorillib/string/inflections.rb +6 -76
- data/lib/gorillib/string/inflector.rb +192 -0
- data/lib/gorillib/string/simple_inflector.rb +267 -0
- data/lib/gorillib/type/extended.rb +52 -0
- data/lib/gorillib/utils/capture_output.rb +28 -0
- data/lib/gorillib/utils/console.rb +131 -0
- data/lib/gorillib/utils/nuke_constants.rb +9 -0
- data/lib/gorillib/utils/stub_module.rb +33 -0
- data/spec/examples/builder/ironfan_spec.rb +37 -0
- data/spec/extlib/hash_spec.rb +64 -0
- data/spec/extlib/mash_spec.rb +312 -0
- data/spec/{array → gorillib/array}/compact_blank_spec.rb +2 -2
- data/spec/{array → gorillib/array}/extract_options_spec.rb +2 -2
- data/spec/gorillib/builder_spec.rb +187 -0
- data/spec/gorillib/collection_spec.rb +20 -0
- data/spec/gorillib/configurable_spec.rb +62 -0
- data/spec/{datetime → gorillib/datetime}/parse_spec.rb +3 -3
- data/spec/{datetime/flat_spec.rb → gorillib/datetime/to_flat_spec.rb} +4 -4
- data/spec/{enumerable → gorillib/enumerable}/sum_spec.rb +5 -5
- data/spec/gorillib/exception/raisers_spec.rb +60 -0
- data/spec/{hash → gorillib/hash}/compact_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/deep_compact_spec.rb +3 -3
- data/spec/{hash → gorillib/hash}/deep_merge_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/keys_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/reverse_merge_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/slice_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/zip_spec.rb +2 -2
- data/spec/{hashlike → gorillib/hashlike}/behave_same_as_hash_spec.rb +6 -3
- data/spec/{hashlike → gorillib/hashlike}/deep_hash_spec.rb +2 -2
- data/spec/{hashlike → gorillib/hashlike}/hashlike_behavior_spec.rb +32 -30
- data/spec/{hashlike → gorillib/hashlike}/hashlike_via_accessors_spec.rb +3 -3
- data/spec/{hashlike_spec.rb → gorillib/hashlike_spec.rb} +3 -3
- data/spec/{logger → gorillib/logger}/log_spec.rb +2 -2
- data/spec/{metaprogramming → gorillib/metaprogramming}/aliasing_spec.rb +3 -3
- data/spec/{metaprogramming → gorillib/metaprogramming}/class_attribute_spec.rb +3 -3
- data/spec/{metaprogramming → gorillib/metaprogramming}/delegation_spec.rb +3 -3
- data/spec/{metaprogramming → gorillib/metaprogramming}/singleton_class_spec.rb +3 -3
- data/spec/gorillib/model/record/defaults_spec.rb +108 -0
- data/spec/gorillib/model/record/factories_spec.rb +321 -0
- data/spec/gorillib/model/record/overlay_spec.rb +46 -0
- data/spec/gorillib/model/serialization_spec.rb +48 -0
- data/spec/gorillib/model_spec.rb +281 -0
- data/spec/{numeric → gorillib/numeric}/clamp_spec.rb +2 -2
- data/spec/{object → gorillib/object}/blank_spec.rb +2 -2
- data/spec/{object → gorillib/object}/try_dup_spec.rb +2 -2
- data/spec/{object → gorillib/object}/try_spec.rb +3 -2
- data/spec/gorillib/pathname_spec.rb +114 -0
- data/spec/{string → gorillib/string}/constantize_spec.rb +2 -2
- data/spec/{string → gorillib/string}/human_spec.rb +2 -2
- data/spec/{string → gorillib/string}/inflections_spec.rb +4 -3
- data/spec/{string → gorillib/string}/inflector_test_cases.rb +0 -0
- data/spec/{string → gorillib/string}/truncate_spec.rb +4 -10
- data/spec/gorillib/type/extended_spec.rb +120 -0
- data/spec/gorillib/utils/capture_output_spec.rb +71 -0
- data/spec/spec_helper.rb +8 -11
- data/spec/support/gorillib_test_helpers.rb +66 -0
- data/spec/support/hashlike_fuzzing_helper.rb +31 -33
- data/spec/support/hashlike_helper.rb +3 -3
- data/spec/support/model_test_helpers.rb +81 -0
- data/spec/support/shared_examples/included_module.rb +20 -0
- metadata +177 -158
- data/lib/gorillib/array/average.rb +0 -13
- data/lib/gorillib/array/sorted_median.rb +0 -11
- data/lib/gorillib/array/sorted_percentile.rb +0 -11
- data/lib/gorillib/array/sorted_sample.rb +0 -12
- data/lib/gorillib/dsl_object.rb +0 -64
- data/lib/gorillib/hash/indifferent_access.rb +0 -207
- data/lib/gorillib/hash/tree_merge.rb +0 -4
- data/lib/gorillib/hashlike/tree_merge.rb +0 -49
- data/lib/gorillib/metaprogramming/cattr_accessor.rb +0 -79
- data/lib/gorillib/metaprogramming/mattr_accessor.rb +0 -61
- data/lib/gorillib/receiver/active_model_shim.rb +0 -32
- data/lib/gorillib/receiver/acts_as_hash.rb +0 -195
- data/lib/gorillib/receiver/acts_as_loadable.rb +0 -42
- data/lib/gorillib/receiver/locale/en.yml +0 -27
- data/lib/gorillib/receiver/tree_diff.rb +0 -74
- data/lib/gorillib/receiver/validations.rb +0 -30
- data/lib/gorillib/receiver.rb +0 -402
- data/lib/gorillib/receiver_model.rb +0 -21
- data/lib/gorillib/struct/acts_as_hash.rb +0 -108
- data/notes/fancy_hashes_and_receivers.textile +0 -120
- data/notes/hash_rdocs.textile +0 -97
- data/spec/array/average_spec.rb +0 -24
- data/spec/array/sorted_median_spec.rb +0 -18
- data/spec/array/sorted_percentile_spec.rb +0 -24
- data/spec/array/sorted_sample_spec.rb +0 -28
- data/spec/dsl_object_spec.rb +0 -99
- data/spec/hash/indifferent_access_spec.rb +0 -391
- data/spec/metaprogramming/cattr_accessor_spec.rb +0 -43
- data/spec/metaprogramming/mattr_accessor_spec.rb +0 -45
- data/spec/receiver/acts_as_hash_spec.rb +0 -295
- data/spec/receiver_spec.rb +0 -551
- data/spec/struct/acts_as_hash_fuzz_spec.rb +0 -71
- data/spec/struct/acts_as_hash_spec.rb +0 -422
metadata
CHANGED
@@ -1,133 +1,130 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gorillib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0pre
|
5
|
+
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Infochimps
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *2165912900
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: bundler
|
27
|
-
requirement: &2165912000 !ruby/object:Gem::Requirement
|
15
|
+
name: multi_json
|
16
|
+
requirement: &2159487420 !ruby/object:Gem::Requirement
|
28
17
|
none: false
|
29
18
|
requirements:
|
30
19
|
- - ~>
|
31
20
|
- !ruby/object:Gem::Version
|
32
|
-
version: '1'
|
33
|
-
type: :
|
21
|
+
version: '1.1'
|
22
|
+
type: :runtime
|
34
23
|
prerelease: false
|
35
|
-
version_requirements: *
|
24
|
+
version_requirements: *2159487420
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
26
|
+
name: json
|
27
|
+
requirement: &2159486860 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
|
-
- -
|
30
|
+
- - ! '>='
|
42
31
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
44
|
-
type: :
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *2159486860
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
37
|
+
name: configliere
|
38
|
+
requirement: &2159486180 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
|
-
- -
|
41
|
+
- - ! '>='
|
53
42
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
type: :
|
43
|
+
version: 0.4.13
|
44
|
+
type: :runtime
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *2159486180
|
58
47
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement: &
|
48
|
+
name: bundler
|
49
|
+
requirement: &2159485700 !ruby/object:Gem::Requirement
|
61
50
|
none: false
|
62
51
|
requirements:
|
63
52
|
- - ~>
|
64
53
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
54
|
+
version: '1'
|
66
55
|
type: :development
|
67
56
|
prerelease: false
|
68
|
-
version_requirements: *
|
57
|
+
version_requirements: *2159485700
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: &
|
59
|
+
name: pry
|
60
|
+
requirement: &2159485080 !ruby/object:Gem::Requirement
|
72
61
|
none: false
|
73
62
|
requirements:
|
74
|
-
- -
|
63
|
+
- - ! '>='
|
75
64
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
65
|
+
version: '0'
|
77
66
|
type: :development
|
78
67
|
prerelease: false
|
79
|
-
version_requirements: *
|
68
|
+
version_requirements: *2159485080
|
80
69
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement: &
|
70
|
+
name: jeweler
|
71
|
+
requirement: &2159484400 !ruby/object:Gem::Requirement
|
83
72
|
none: false
|
84
73
|
requirements:
|
85
74
|
- - ~>
|
86
75
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
76
|
+
version: '1.6'
|
88
77
|
type: :development
|
89
78
|
prerelease: false
|
90
|
-
version_requirements: *
|
79
|
+
version_requirements: *2159484400
|
91
80
|
description: ! 'Gorillib: infochimps lightweight subset of ruby convenience methods'
|
92
81
|
email: coders@infochimps.org
|
93
82
|
executables: []
|
94
83
|
extensions: []
|
95
84
|
extra_rdoc_files:
|
96
|
-
- LICENSE.
|
85
|
+
- LICENSE.md
|
97
86
|
- README.md
|
98
87
|
files:
|
99
88
|
- .gitignore
|
100
89
|
- .rspec
|
101
|
-
-
|
90
|
+
- .yardopts
|
91
|
+
- CHANGELOG.md
|
102
92
|
- Gemfile
|
103
|
-
-
|
93
|
+
- Guardfile
|
94
|
+
- LICENSE.md
|
104
95
|
- README.md
|
105
96
|
- Rakefile
|
97
|
+
- TODO.md
|
106
98
|
- VERSION
|
99
|
+
- examples/builder/ironfan.rb
|
100
|
+
- examples/model/simple.rb
|
107
101
|
- gorillib.gemspec
|
102
|
+
- lib/alt/kernel/call_stack.rb
|
108
103
|
- lib/gorillib.rb
|
109
|
-
- lib/gorillib/array/average.rb
|
110
104
|
- lib/gorillib/array/compact_blank.rb
|
111
105
|
- lib/gorillib/array/deep_compact.rb
|
112
106
|
- lib/gorillib/array/extract_options.rb
|
113
107
|
- lib/gorillib/array/random.rb
|
114
|
-
- lib/gorillib/array/
|
115
|
-
- lib/gorillib/array/sorted_percentile.rb
|
116
|
-
- lib/gorillib/array/sorted_sample.rb
|
108
|
+
- lib/gorillib/array/wrap.rb
|
117
109
|
- lib/gorillib/base.rb
|
118
|
-
- lib/gorillib/
|
110
|
+
- lib/gorillib/builder.rb
|
111
|
+
- lib/gorillib/builder/field.rb
|
112
|
+
- lib/gorillib/collection.rb
|
113
|
+
- lib/gorillib/collection/has_collection.rb
|
114
|
+
- lib/gorillib/configurable.rb
|
119
115
|
- lib/gorillib/datetime/parse.rb
|
120
|
-
- lib/gorillib/
|
116
|
+
- lib/gorillib/datetime/to_flat.rb
|
121
117
|
- lib/gorillib/enumerable/sum.rb
|
118
|
+
- lib/gorillib/exception/confidence.rb
|
119
|
+
- lib/gorillib/exception/raisers.rb
|
122
120
|
- lib/gorillib/hash/compact.rb
|
123
121
|
- lib/gorillib/hash/deep_compact.rb
|
124
122
|
- lib/gorillib/hash/deep_dup.rb
|
125
123
|
- lib/gorillib/hash/deep_merge.rb
|
126
|
-
- lib/gorillib/hash/indifferent_access.rb
|
127
124
|
- lib/gorillib/hash/keys.rb
|
125
|
+
- lib/gorillib/hash/mash.rb
|
128
126
|
- lib/gorillib/hash/reverse_merge.rb
|
129
127
|
- lib/gorillib/hash/slice.rb
|
130
|
-
- lib/gorillib/hash/tree_merge.rb
|
131
128
|
- lib/gorillib/hash/zip.rb
|
132
129
|
- lib/gorillib/hashlike.rb
|
133
130
|
- lib/gorillib/hashlike/compact.rb
|
@@ -139,81 +136,94 @@ files:
|
|
139
136
|
- lib/gorillib/hashlike/keys.rb
|
140
137
|
- lib/gorillib/hashlike/reverse_merge.rb
|
141
138
|
- lib/gorillib/hashlike/slice.rb
|
142
|
-
- lib/gorillib/
|
139
|
+
- lib/gorillib/io/system_helpers.rb
|
143
140
|
- lib/gorillib/logger/log.rb
|
144
141
|
- lib/gorillib/metaprogramming/aliasing.rb
|
145
|
-
- lib/gorillib/metaprogramming/cattr_accessor.rb
|
146
142
|
- lib/gorillib/metaprogramming/class_attribute.rb
|
143
|
+
- lib/gorillib/metaprogramming/concern.rb
|
147
144
|
- lib/gorillib/metaprogramming/delegation.rb
|
148
|
-
- lib/gorillib/metaprogramming/mattr_accessor.rb
|
149
145
|
- lib/gorillib/metaprogramming/remove_method.rb
|
150
146
|
- lib/gorillib/metaprogramming/singleton_class.rb
|
147
|
+
- lib/gorillib/model.rb
|
148
|
+
- lib/gorillib/model/active_model_conversion.rb
|
149
|
+
- lib/gorillib/model/active_model_naming.rb
|
150
|
+
- lib/gorillib/model/active_model_shim.rb
|
151
|
+
- lib/gorillib/model/base.rb
|
152
|
+
- lib/gorillib/model/defaults.rb
|
153
|
+
- lib/gorillib/model/errors.rb
|
154
|
+
- lib/gorillib/model/factories.rb
|
155
|
+
- lib/gorillib/model/field.rb
|
156
|
+
- lib/gorillib/model/named_schema.rb
|
157
|
+
- lib/gorillib/model/overlay.rb
|
158
|
+
- lib/gorillib/model/record_schema.rb
|
159
|
+
- lib/gorillib/model/serialization.rb
|
160
|
+
- lib/gorillib/model/validate.rb
|
151
161
|
- lib/gorillib/numeric/clamp.rb
|
152
162
|
- lib/gorillib/object/blank.rb
|
153
163
|
- lib/gorillib/object/try.rb
|
154
164
|
- lib/gorillib/object/try_dup.rb
|
155
|
-
- lib/gorillib/
|
156
|
-
- lib/gorillib/
|
157
|
-
- lib/gorillib/receiver/acts_as_hash.rb
|
158
|
-
- lib/gorillib/receiver/acts_as_loadable.rb
|
159
|
-
- lib/gorillib/receiver/locale/en.yml
|
160
|
-
- lib/gorillib/receiver/tree_diff.rb
|
161
|
-
- lib/gorillib/receiver/validations.rb
|
162
|
-
- lib/gorillib/receiver_model.rb
|
163
|
-
- lib/gorillib/serialization.rb
|
165
|
+
- lib/gorillib/pathname.rb
|
166
|
+
- lib/gorillib/serialization/to_wire.rb
|
164
167
|
- lib/gorillib/some.rb
|
165
168
|
- lib/gorillib/string/constantize.rb
|
166
169
|
- lib/gorillib/string/human.rb
|
167
170
|
- lib/gorillib/string/inflections.rb
|
171
|
+
- lib/gorillib/string/inflector.rb
|
172
|
+
- lib/gorillib/string/simple_inflector.rb
|
168
173
|
- lib/gorillib/string/truncate.rb
|
169
|
-
- lib/gorillib/
|
170
|
-
- lib/gorillib/
|
171
|
-
-
|
172
|
-
-
|
173
|
-
-
|
174
|
-
- spec/
|
175
|
-
- spec/
|
176
|
-
- spec/
|
177
|
-
- spec/array/
|
178
|
-
- spec/array/
|
179
|
-
- spec/
|
180
|
-
- spec/
|
181
|
-
- spec/
|
182
|
-
- spec/
|
183
|
-
- spec/
|
184
|
-
- spec/
|
185
|
-
- spec/
|
186
|
-
- spec/hash/
|
187
|
-
- spec/hash/
|
188
|
-
- spec/hash/
|
189
|
-
- spec/hash/
|
190
|
-
- spec/hash/
|
191
|
-
- spec/
|
192
|
-
- spec/
|
193
|
-
- spec/hashlike/
|
194
|
-
- spec/hashlike/
|
195
|
-
- spec/
|
196
|
-
- spec/
|
197
|
-
- spec/
|
198
|
-
- spec/
|
199
|
-
- spec/metaprogramming/
|
200
|
-
- spec/metaprogramming/
|
201
|
-
- spec/metaprogramming/
|
202
|
-
- spec/metaprogramming/singleton_class_spec.rb
|
203
|
-
- spec/
|
204
|
-
- spec/
|
205
|
-
- spec/
|
206
|
-
- spec/
|
207
|
-
- spec/
|
208
|
-
- spec/
|
174
|
+
- lib/gorillib/type/extended.rb
|
175
|
+
- lib/gorillib/utils/capture_output.rb
|
176
|
+
- lib/gorillib/utils/console.rb
|
177
|
+
- lib/gorillib/utils/nuke_constants.rb
|
178
|
+
- lib/gorillib/utils/stub_module.rb
|
179
|
+
- spec/examples/builder/ironfan_spec.rb
|
180
|
+
- spec/extlib/hash_spec.rb
|
181
|
+
- spec/extlib/mash_spec.rb
|
182
|
+
- spec/gorillib/array/compact_blank_spec.rb
|
183
|
+
- spec/gorillib/array/extract_options_spec.rb
|
184
|
+
- spec/gorillib/builder_spec.rb
|
185
|
+
- spec/gorillib/collection_spec.rb
|
186
|
+
- spec/gorillib/configurable_spec.rb
|
187
|
+
- spec/gorillib/datetime/parse_spec.rb
|
188
|
+
- spec/gorillib/datetime/to_flat_spec.rb
|
189
|
+
- spec/gorillib/enumerable/sum_spec.rb
|
190
|
+
- spec/gorillib/exception/raisers_spec.rb
|
191
|
+
- spec/gorillib/hash/compact_spec.rb
|
192
|
+
- spec/gorillib/hash/deep_compact_spec.rb
|
193
|
+
- spec/gorillib/hash/deep_merge_spec.rb
|
194
|
+
- spec/gorillib/hash/keys_spec.rb
|
195
|
+
- spec/gorillib/hash/reverse_merge_spec.rb
|
196
|
+
- spec/gorillib/hash/slice_spec.rb
|
197
|
+
- spec/gorillib/hash/zip_spec.rb
|
198
|
+
- spec/gorillib/hashlike/behave_same_as_hash_spec.rb
|
199
|
+
- spec/gorillib/hashlike/deep_hash_spec.rb
|
200
|
+
- spec/gorillib/hashlike/hashlike_behavior_spec.rb
|
201
|
+
- spec/gorillib/hashlike/hashlike_via_accessors_spec.rb
|
202
|
+
- spec/gorillib/hashlike_spec.rb
|
203
|
+
- spec/gorillib/logger/log_spec.rb
|
204
|
+
- spec/gorillib/metaprogramming/aliasing_spec.rb
|
205
|
+
- spec/gorillib/metaprogramming/class_attribute_spec.rb
|
206
|
+
- spec/gorillib/metaprogramming/delegation_spec.rb
|
207
|
+
- spec/gorillib/metaprogramming/singleton_class_spec.rb
|
208
|
+
- spec/gorillib/model/record/defaults_spec.rb
|
209
|
+
- spec/gorillib/model/record/factories_spec.rb
|
210
|
+
- spec/gorillib/model/record/overlay_spec.rb
|
211
|
+
- spec/gorillib/model/serialization_spec.rb
|
212
|
+
- spec/gorillib/model_spec.rb
|
213
|
+
- spec/gorillib/numeric/clamp_spec.rb
|
214
|
+
- spec/gorillib/object/blank_spec.rb
|
215
|
+
- spec/gorillib/object/try_dup_spec.rb
|
216
|
+
- spec/gorillib/object/try_spec.rb
|
217
|
+
- spec/gorillib/pathname_spec.rb
|
218
|
+
- spec/gorillib/string/constantize_spec.rb
|
219
|
+
- spec/gorillib/string/human_spec.rb
|
220
|
+
- spec/gorillib/string/inflections_spec.rb
|
221
|
+
- spec/gorillib/string/inflector_test_cases.rb
|
222
|
+
- spec/gorillib/string/truncate_spec.rb
|
223
|
+
- spec/gorillib/type/extended_spec.rb
|
224
|
+
- spec/gorillib/utils/capture_output_spec.rb
|
209
225
|
- spec/spec_helper.rb
|
210
|
-
- spec/
|
211
|
-
- spec/string/human_spec.rb
|
212
|
-
- spec/string/inflections_spec.rb
|
213
|
-
- spec/string/inflector_test_cases.rb
|
214
|
-
- spec/string/truncate_spec.rb
|
215
|
-
- spec/struct/acts_as_hash_fuzz_spec.rb
|
216
|
-
- spec/struct/acts_as_hash_spec.rb
|
226
|
+
- spec/support/gorillib_test_helpers.rb
|
217
227
|
- spec/support/hashlike_fuzzing_helper.rb
|
218
228
|
- spec/support/hashlike_helper.rb
|
219
229
|
- spec/support/hashlike_struct_helper.rb
|
@@ -223,6 +233,8 @@ files:
|
|
223
233
|
- spec/support/matchers/be_hash_eql.rb
|
224
234
|
- spec/support/matchers/enumerate_method.rb
|
225
235
|
- spec/support/matchers/evaluate_to_true.rb
|
236
|
+
- spec/support/model_test_helpers.rb
|
237
|
+
- spec/support/shared_examples/included_module.rb
|
226
238
|
homepage: http://infochimps.com/labs
|
227
239
|
licenses:
|
228
240
|
- MIT
|
@@ -238,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
250
|
version: '0'
|
239
251
|
segments:
|
240
252
|
- 0
|
241
|
-
hash:
|
253
|
+
hash: -645354043939848167
|
242
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
255
|
none: false
|
244
256
|
requirements:
|
@@ -252,50 +264,54 @@ signing_key:
|
|
252
264
|
specification_version: 3
|
253
265
|
summary: include only what you need. No dependencies, no creep
|
254
266
|
test_files:
|
255
|
-
- spec/
|
256
|
-
- spec/
|
257
|
-
- spec/
|
258
|
-
- spec/array/
|
259
|
-
- spec/array/
|
260
|
-
- spec/
|
261
|
-
- spec/
|
262
|
-
- spec/
|
263
|
-
- spec/
|
264
|
-
- spec/
|
265
|
-
- spec/
|
266
|
-
- spec/
|
267
|
-
- spec/hash/
|
268
|
-
- spec/hash/
|
269
|
-
- spec/hash/
|
270
|
-
- spec/hash/
|
271
|
-
- spec/hash/
|
272
|
-
- spec/hash/
|
273
|
-
- spec/
|
274
|
-
- spec/hashlike/
|
275
|
-
- spec/hashlike/
|
276
|
-
- spec/hashlike/
|
277
|
-
- spec/
|
278
|
-
- spec/
|
279
|
-
- spec/
|
280
|
-
- spec/metaprogramming/
|
281
|
-
- spec/metaprogramming/class_attribute_spec.rb
|
282
|
-
- spec/metaprogramming/delegation_spec.rb
|
283
|
-
- spec/metaprogramming/
|
284
|
-
- spec/
|
285
|
-
- spec/
|
286
|
-
- spec/
|
287
|
-
- spec/
|
288
|
-
- spec/
|
289
|
-
- spec/
|
290
|
-
- spec/
|
267
|
+
- spec/examples/builder/ironfan_spec.rb
|
268
|
+
- spec/extlib/hash_spec.rb
|
269
|
+
- spec/extlib/mash_spec.rb
|
270
|
+
- spec/gorillib/array/compact_blank_spec.rb
|
271
|
+
- spec/gorillib/array/extract_options_spec.rb
|
272
|
+
- spec/gorillib/builder_spec.rb
|
273
|
+
- spec/gorillib/collection_spec.rb
|
274
|
+
- spec/gorillib/configurable_spec.rb
|
275
|
+
- spec/gorillib/datetime/parse_spec.rb
|
276
|
+
- spec/gorillib/datetime/to_flat_spec.rb
|
277
|
+
- spec/gorillib/enumerable/sum_spec.rb
|
278
|
+
- spec/gorillib/exception/raisers_spec.rb
|
279
|
+
- spec/gorillib/hash/compact_spec.rb
|
280
|
+
- spec/gorillib/hash/deep_compact_spec.rb
|
281
|
+
- spec/gorillib/hash/deep_merge_spec.rb
|
282
|
+
- spec/gorillib/hash/keys_spec.rb
|
283
|
+
- spec/gorillib/hash/reverse_merge_spec.rb
|
284
|
+
- spec/gorillib/hash/slice_spec.rb
|
285
|
+
- spec/gorillib/hash/zip_spec.rb
|
286
|
+
- spec/gorillib/hashlike/behave_same_as_hash_spec.rb
|
287
|
+
- spec/gorillib/hashlike/deep_hash_spec.rb
|
288
|
+
- spec/gorillib/hashlike/hashlike_behavior_spec.rb
|
289
|
+
- spec/gorillib/hashlike/hashlike_via_accessors_spec.rb
|
290
|
+
- spec/gorillib/hashlike_spec.rb
|
291
|
+
- spec/gorillib/logger/log_spec.rb
|
292
|
+
- spec/gorillib/metaprogramming/aliasing_spec.rb
|
293
|
+
- spec/gorillib/metaprogramming/class_attribute_spec.rb
|
294
|
+
- spec/gorillib/metaprogramming/delegation_spec.rb
|
295
|
+
- spec/gorillib/metaprogramming/singleton_class_spec.rb
|
296
|
+
- spec/gorillib/model/record/defaults_spec.rb
|
297
|
+
- spec/gorillib/model/record/factories_spec.rb
|
298
|
+
- spec/gorillib/model/record/overlay_spec.rb
|
299
|
+
- spec/gorillib/model/serialization_spec.rb
|
300
|
+
- spec/gorillib/model_spec.rb
|
301
|
+
- spec/gorillib/numeric/clamp_spec.rb
|
302
|
+
- spec/gorillib/object/blank_spec.rb
|
303
|
+
- spec/gorillib/object/try_dup_spec.rb
|
304
|
+
- spec/gorillib/object/try_spec.rb
|
305
|
+
- spec/gorillib/pathname_spec.rb
|
306
|
+
- spec/gorillib/string/constantize_spec.rb
|
307
|
+
- spec/gorillib/string/human_spec.rb
|
308
|
+
- spec/gorillib/string/inflections_spec.rb
|
309
|
+
- spec/gorillib/string/inflector_test_cases.rb
|
310
|
+
- spec/gorillib/string/truncate_spec.rb
|
311
|
+
- spec/gorillib/type/extended_spec.rb
|
312
|
+
- spec/gorillib/utils/capture_output_spec.rb
|
291
313
|
- spec/spec_helper.rb
|
292
|
-
- spec/
|
293
|
-
- spec/string/human_spec.rb
|
294
|
-
- spec/string/inflections_spec.rb
|
295
|
-
- spec/string/inflector_test_cases.rb
|
296
|
-
- spec/string/truncate_spec.rb
|
297
|
-
- spec/struct/acts_as_hash_fuzz_spec.rb
|
298
|
-
- spec/struct/acts_as_hash_spec.rb
|
314
|
+
- spec/support/gorillib_test_helpers.rb
|
299
315
|
- spec/support/hashlike_fuzzing_helper.rb
|
300
316
|
- spec/support/hashlike_helper.rb
|
301
317
|
- spec/support/hashlike_struct_helper.rb
|
@@ -305,3 +321,6 @@ test_files:
|
|
305
321
|
- spec/support/matchers/be_hash_eql.rb
|
306
322
|
- spec/support/matchers/enumerate_method.rb
|
307
323
|
- spec/support/matchers/evaluate_to_true.rb
|
324
|
+
- spec/support/model_test_helpers.rb
|
325
|
+
- spec/support/shared_examples/included_module.rb
|
326
|
+
has_rdoc:
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
#
|
3
|
-
# Return the average of my elements.
|
4
|
-
#
|
5
|
-
# precondition: Each element must be convertible to a float.
|
6
|
-
#
|
7
|
-
def average
|
8
|
-
return nil if empty?
|
9
|
-
raise ArgumentError, "Couldn't convert all elements to float!" unless
|
10
|
-
all?{|e| e.methods.index :to_f}
|
11
|
-
return map(&:to_f).inject(:+) / size
|
12
|
-
end
|
13
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
#
|
3
|
-
# Returns the middle element of odd-sized arrays. For even arrays,
|
4
|
-
# it will return one of the two middle elements. Precisely which is
|
5
|
-
# undefined, except that it will consistently return one or the
|
6
|
-
# other.
|
7
|
-
#
|
8
|
-
def sorted_median
|
9
|
-
return self[(size - 1) * 0.5]
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
#
|
3
|
-
# Returns the element at the position closest to the given
|
4
|
-
# percentile. For example, sorted_percentile 0.0 will return the
|
5
|
-
# first element and sorted_percentile 100.0 will return the last
|
6
|
-
# element.
|
7
|
-
#
|
8
|
-
def sorted_percentile percentile
|
9
|
-
return self[(size - 1) * percentile / 100.0]
|
10
|
-
end
|
11
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
#
|
3
|
-
# Returns the middle element of odd-sized arrays. For even arrays,
|
4
|
-
# it will return one of the two middle elements. Precisely which is
|
5
|
-
# undefined, except that it will consistently return one or the
|
6
|
-
# other.
|
7
|
-
#
|
8
|
-
def sorted_sample num
|
9
|
-
return [] if empty?
|
10
|
-
(1..num).map{|i| self[(size - 1) * i / (num)]}.uniq
|
11
|
-
end
|
12
|
-
end
|
data/lib/gorillib/dsl_object.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'gorillib'
|
2
|
-
|
3
|
-
class DslObject
|
4
|
-
|
5
|
-
class_attribute :properties
|
6
|
-
self.properties = {}
|
7
|
-
|
8
|
-
def self.property(name, opts={})
|
9
|
-
unless method_defined? name
|
10
|
-
define_method(name) do |val=nil|
|
11
|
-
set(name, val) unless val.nil?
|
12
|
-
get(name)
|
13
|
-
end
|
14
|
-
self.properties[name.to_sym] = opts[:default] || nil
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize(attrs={})
|
19
|
-
define_properties!(attrs)
|
20
|
-
impose_defaults!
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
def configure(attrs={}, &block)
|
25
|
-
define_properties!(attrs)
|
26
|
-
instance_eval(&block) if block
|
27
|
-
self
|
28
|
-
end
|
29
|
-
|
30
|
-
def set(property, val)
|
31
|
-
instance_variable_set("@" + property.to_s, val)
|
32
|
-
end
|
33
|
-
|
34
|
-
def get(property)
|
35
|
-
instance_variable_get("@" + property.to_s)
|
36
|
-
end
|
37
|
-
|
38
|
-
def set?(property)
|
39
|
-
instance_variable_defined?("@" + property.to_s)
|
40
|
-
end
|
41
|
-
|
42
|
-
def unset!(property)
|
43
|
-
remove_instance_variable("@" + property.to_s) if set?(property)
|
44
|
-
end
|
45
|
-
|
46
|
-
def to_hash
|
47
|
-
self.properties.inject({}){ |hsh,(key,val)| hsh[key] = get(key) ; hsh }
|
48
|
-
end
|
49
|
-
|
50
|
-
def to_s
|
51
|
-
"<#{self.class} #{to_hash.inspect}>"
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def impose_defaults!
|
57
|
-
self.class.properties.each{ |key, val| set(key, val) unless set?(key) }
|
58
|
-
end
|
59
|
-
|
60
|
-
def define_properties!(hsh)
|
61
|
-
hsh.each{ |name,val| self.class.property(name); set(name, val) }
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|