gorillib 0.1.11 → 0.4.0pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/.gitignore +1 -0
  2. data/.rspec +1 -2
  3. data/.yardopts +9 -0
  4. data/{CHANGELOG.textile → CHANGELOG.md} +35 -9
  5. data/Gemfile +21 -14
  6. data/Guardfile +19 -0
  7. data/{LICENSE.textile → LICENSE.md} +43 -29
  8. data/README.md +47 -52
  9. data/Rakefile +31 -30
  10. data/TODO.md +32 -0
  11. data/VERSION +1 -1
  12. data/examples/builder/ironfan.rb +133 -0
  13. data/examples/model/simple.rb +17 -0
  14. data/gorillib.gemspec +106 -86
  15. data/lib/alt/kernel/call_stack.rb +56 -0
  16. data/lib/gorillib/array/wrap.rb +53 -0
  17. data/lib/gorillib/base.rb +3 -3
  18. data/lib/gorillib/builder/field.rb +5 -0
  19. data/lib/gorillib/builder.rb +260 -0
  20. data/lib/gorillib/collection/has_collection.rb +31 -0
  21. data/lib/gorillib/collection.rb +129 -0
  22. data/lib/gorillib/configurable.rb +28 -0
  23. data/lib/gorillib/datetime/{flat.rb → to_flat.rb} +0 -0
  24. data/lib/gorillib/exception/confidence.rb +17 -0
  25. data/lib/gorillib/exception/raisers.rb +78 -0
  26. data/lib/gorillib/hash/mash.rb +202 -0
  27. data/lib/gorillib/hashlike/slice.rb +53 -19
  28. data/lib/gorillib/hashlike.rb +5 -3
  29. data/lib/gorillib/io/system_helpers.rb +30 -0
  30. data/lib/gorillib/logger/log.rb +18 -0
  31. data/lib/gorillib/metaprogramming/concern.rb +124 -0
  32. data/lib/gorillib/model/active_model_conversion.rb +68 -0
  33. data/lib/gorillib/model/active_model_naming.rb +87 -0
  34. data/lib/gorillib/model/active_model_shim.rb +33 -0
  35. data/lib/gorillib/model/base.rb +341 -0
  36. data/lib/gorillib/model/defaults.rb +71 -0
  37. data/lib/gorillib/model/errors.rb +14 -0
  38. data/lib/gorillib/model/factories.rb +372 -0
  39. data/lib/gorillib/model/field.rb +146 -0
  40. data/lib/gorillib/model/named_schema.rb +53 -0
  41. data/lib/gorillib/{struct/hashlike_iteration.rb → model/overlay.rb} +0 -0
  42. data/lib/gorillib/model/record_schema.rb +9 -0
  43. data/lib/gorillib/model/serialization.rb +23 -0
  44. data/lib/gorillib/model/validate.rb +22 -0
  45. data/lib/gorillib/model.rb +23 -0
  46. data/lib/gorillib/pathname.rb +78 -0
  47. data/lib/gorillib/{serialization.rb → serialization/to_wire.rb} +0 -0
  48. data/lib/gorillib/some.rb +11 -9
  49. data/lib/gorillib/string/constantize.rb +21 -14
  50. data/lib/gorillib/string/inflections.rb +6 -76
  51. data/lib/gorillib/string/inflector.rb +192 -0
  52. data/lib/gorillib/string/simple_inflector.rb +267 -0
  53. data/lib/gorillib/type/extended.rb +52 -0
  54. data/lib/gorillib/utils/capture_output.rb +28 -0
  55. data/lib/gorillib/utils/console.rb +131 -0
  56. data/lib/gorillib/utils/nuke_constants.rb +9 -0
  57. data/lib/gorillib/utils/stub_module.rb +33 -0
  58. data/spec/examples/builder/ironfan_spec.rb +37 -0
  59. data/spec/extlib/hash_spec.rb +64 -0
  60. data/spec/extlib/mash_spec.rb +312 -0
  61. data/spec/{array → gorillib/array}/compact_blank_spec.rb +2 -2
  62. data/spec/{array → gorillib/array}/extract_options_spec.rb +2 -2
  63. data/spec/gorillib/builder_spec.rb +187 -0
  64. data/spec/gorillib/collection_spec.rb +20 -0
  65. data/spec/gorillib/configurable_spec.rb +62 -0
  66. data/spec/{datetime → gorillib/datetime}/parse_spec.rb +3 -3
  67. data/spec/{datetime/flat_spec.rb → gorillib/datetime/to_flat_spec.rb} +4 -4
  68. data/spec/{enumerable → gorillib/enumerable}/sum_spec.rb +5 -5
  69. data/spec/gorillib/exception/raisers_spec.rb +60 -0
  70. data/spec/{hash → gorillib/hash}/compact_spec.rb +2 -2
  71. data/spec/{hash → gorillib/hash}/deep_compact_spec.rb +3 -3
  72. data/spec/{hash → gorillib/hash}/deep_merge_spec.rb +2 -2
  73. data/spec/{hash → gorillib/hash}/keys_spec.rb +2 -2
  74. data/spec/{hash → gorillib/hash}/reverse_merge_spec.rb +2 -2
  75. data/spec/{hash → gorillib/hash}/slice_spec.rb +2 -2
  76. data/spec/{hash → gorillib/hash}/zip_spec.rb +2 -2
  77. data/spec/{hashlike → gorillib/hashlike}/behave_same_as_hash_spec.rb +6 -3
  78. data/spec/{hashlike → gorillib/hashlike}/deep_hash_spec.rb +2 -2
  79. data/spec/{hashlike → gorillib/hashlike}/hashlike_behavior_spec.rb +32 -30
  80. data/spec/{hashlike → gorillib/hashlike}/hashlike_via_accessors_spec.rb +3 -3
  81. data/spec/{hashlike_spec.rb → gorillib/hashlike_spec.rb} +3 -3
  82. data/spec/{logger → gorillib/logger}/log_spec.rb +2 -2
  83. data/spec/{metaprogramming → gorillib/metaprogramming}/aliasing_spec.rb +3 -3
  84. data/spec/{metaprogramming → gorillib/metaprogramming}/class_attribute_spec.rb +3 -3
  85. data/spec/{metaprogramming → gorillib/metaprogramming}/delegation_spec.rb +3 -3
  86. data/spec/{metaprogramming → gorillib/metaprogramming}/singleton_class_spec.rb +3 -3
  87. data/spec/gorillib/model/record/defaults_spec.rb +108 -0
  88. data/spec/gorillib/model/record/factories_spec.rb +321 -0
  89. data/spec/gorillib/model/record/overlay_spec.rb +46 -0
  90. data/spec/gorillib/model/serialization_spec.rb +48 -0
  91. data/spec/gorillib/model_spec.rb +281 -0
  92. data/spec/{numeric → gorillib/numeric}/clamp_spec.rb +2 -2
  93. data/spec/{object → gorillib/object}/blank_spec.rb +2 -2
  94. data/spec/{object → gorillib/object}/try_dup_spec.rb +2 -2
  95. data/spec/{object → gorillib/object}/try_spec.rb +3 -2
  96. data/spec/gorillib/pathname_spec.rb +114 -0
  97. data/spec/{string → gorillib/string}/constantize_spec.rb +2 -2
  98. data/spec/{string → gorillib/string}/human_spec.rb +2 -2
  99. data/spec/{string → gorillib/string}/inflections_spec.rb +4 -3
  100. data/spec/{string → gorillib/string}/inflector_test_cases.rb +0 -0
  101. data/spec/{string → gorillib/string}/truncate_spec.rb +4 -10
  102. data/spec/gorillib/type/extended_spec.rb +120 -0
  103. data/spec/gorillib/utils/capture_output_spec.rb +71 -0
  104. data/spec/spec_helper.rb +8 -11
  105. data/spec/support/gorillib_test_helpers.rb +66 -0
  106. data/spec/support/hashlike_fuzzing_helper.rb +31 -33
  107. data/spec/support/hashlike_helper.rb +3 -3
  108. data/spec/support/model_test_helpers.rb +81 -0
  109. data/spec/support/shared_examples/included_module.rb +20 -0
  110. metadata +177 -158
  111. data/lib/gorillib/array/average.rb +0 -13
  112. data/lib/gorillib/array/sorted_median.rb +0 -11
  113. data/lib/gorillib/array/sorted_percentile.rb +0 -11
  114. data/lib/gorillib/array/sorted_sample.rb +0 -12
  115. data/lib/gorillib/dsl_object.rb +0 -64
  116. data/lib/gorillib/hash/indifferent_access.rb +0 -207
  117. data/lib/gorillib/hash/tree_merge.rb +0 -4
  118. data/lib/gorillib/hashlike/tree_merge.rb +0 -49
  119. data/lib/gorillib/metaprogramming/cattr_accessor.rb +0 -79
  120. data/lib/gorillib/metaprogramming/mattr_accessor.rb +0 -61
  121. data/lib/gorillib/receiver/active_model_shim.rb +0 -32
  122. data/lib/gorillib/receiver/acts_as_hash.rb +0 -195
  123. data/lib/gorillib/receiver/acts_as_loadable.rb +0 -42
  124. data/lib/gorillib/receiver/locale/en.yml +0 -27
  125. data/lib/gorillib/receiver/tree_diff.rb +0 -74
  126. data/lib/gorillib/receiver/validations.rb +0 -30
  127. data/lib/gorillib/receiver.rb +0 -402
  128. data/lib/gorillib/receiver_model.rb +0 -21
  129. data/lib/gorillib/struct/acts_as_hash.rb +0 -108
  130. data/notes/fancy_hashes_and_receivers.textile +0 -120
  131. data/notes/hash_rdocs.textile +0 -97
  132. data/spec/array/average_spec.rb +0 -24
  133. data/spec/array/sorted_median_spec.rb +0 -18
  134. data/spec/array/sorted_percentile_spec.rb +0 -24
  135. data/spec/array/sorted_sample_spec.rb +0 -28
  136. data/spec/dsl_object_spec.rb +0 -99
  137. data/spec/hash/indifferent_access_spec.rb +0 -391
  138. data/spec/metaprogramming/cattr_accessor_spec.rb +0 -43
  139. data/spec/metaprogramming/mattr_accessor_spec.rb +0 -45
  140. data/spec/receiver/acts_as_hash_spec.rb +0 -295
  141. data/spec/receiver_spec.rb +0 -551
  142. data/spec/struct/acts_as_hash_fuzz_spec.rb +0 -71
  143. 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.1.11
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-06-22 00:00:00.000000000Z
12
+ date: 2012-08-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: json
16
- requirement: &2165912900 !ruby/object:Gem::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: :development
21
+ version: '1.1'
22
+ type: :runtime
34
23
  prerelease: false
35
- version_requirements: *2165912000
24
+ version_requirements: *2159487420
36
25
  - !ruby/object:Gem::Dependency
37
- name: jeweler
38
- requirement: &2165911060 !ruby/object:Gem::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: '1.6'
44
- type: :development
32
+ version: '0'
33
+ type: :runtime
45
34
  prerelease: false
46
- version_requirements: *2165911060
35
+ version_requirements: *2159486860
47
36
  - !ruby/object:Gem::Dependency
48
- name: rspec
49
- requirement: &2165910200 !ruby/object:Gem::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: '2.5'
55
- type: :development
43
+ version: 0.4.13
44
+ type: :runtime
56
45
  prerelease: false
57
- version_requirements: *2165910200
46
+ version_requirements: *2159486180
58
47
  - !ruby/object:Gem::Dependency
59
- name: yard
60
- requirement: &2165909260 !ruby/object:Gem::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: '0.6'
54
+ version: '1'
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *2165909260
57
+ version_requirements: *2159485700
69
58
  - !ruby/object:Gem::Dependency
70
- name: cucumber
71
- requirement: &2165908340 !ruby/object:Gem::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: '1'
65
+ version: '0'
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *2165908340
68
+ version_requirements: *2159485080
80
69
  - !ruby/object:Gem::Dependency
81
- name: aruba
82
- requirement: &2165907460 !ruby/object:Gem::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: '0.4'
76
+ version: '1.6'
88
77
  type: :development
89
78
  prerelease: false
90
- version_requirements: *2165907460
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.textile
85
+ - LICENSE.md
97
86
  - README.md
98
87
  files:
99
88
  - .gitignore
100
89
  - .rspec
101
- - CHANGELOG.textile
90
+ - .yardopts
91
+ - CHANGELOG.md
102
92
  - Gemfile
103
- - LICENSE.textile
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/sorted_median.rb
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/datetime/flat.rb
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/dsl_object.rb
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/hashlike/tree_merge.rb
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/receiver.rb
156
- - lib/gorillib/receiver/active_model_shim.rb
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/struct/acts_as_hash.rb
170
- - lib/gorillib/struct/hashlike_iteration.rb
171
- - notes/fancy_hashes_and_receivers.textile
172
- - notes/hash_rdocs.textile
173
- - spec/array/average_spec.rb
174
- - spec/array/compact_blank_spec.rb
175
- - spec/array/extract_options_spec.rb
176
- - spec/array/sorted_median_spec.rb
177
- - spec/array/sorted_percentile_spec.rb
178
- - spec/array/sorted_sample_spec.rb
179
- - spec/datetime/flat_spec.rb
180
- - spec/datetime/parse_spec.rb
181
- - spec/dsl_object_spec.rb
182
- - spec/enumerable/sum_spec.rb
183
- - spec/hash/compact_spec.rb
184
- - spec/hash/deep_compact_spec.rb
185
- - spec/hash/deep_merge_spec.rb
186
- - spec/hash/indifferent_access_spec.rb
187
- - spec/hash/keys_spec.rb
188
- - spec/hash/reverse_merge_spec.rb
189
- - spec/hash/slice_spec.rb
190
- - spec/hash/zip_spec.rb
191
- - spec/hashlike/behave_same_as_hash_spec.rb
192
- - spec/hashlike/deep_hash_spec.rb
193
- - spec/hashlike/hashlike_behavior_spec.rb
194
- - spec/hashlike/hashlike_via_accessors_spec.rb
195
- - spec/hashlike_spec.rb
196
- - spec/logger/log_spec.rb
197
- - spec/metaprogramming/aliasing_spec.rb
198
- - spec/metaprogramming/cattr_accessor_spec.rb
199
- - spec/metaprogramming/class_attribute_spec.rb
200
- - spec/metaprogramming/delegation_spec.rb
201
- - spec/metaprogramming/mattr_accessor_spec.rb
202
- - spec/metaprogramming/singleton_class_spec.rb
203
- - spec/numeric/clamp_spec.rb
204
- - spec/object/blank_spec.rb
205
- - spec/object/try_dup_spec.rb
206
- - spec/object/try_spec.rb
207
- - spec/receiver/acts_as_hash_spec.rb
208
- - spec/receiver_spec.rb
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/string/constantize_spec.rb
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: 4215957582273212195
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/array/average_spec.rb
256
- - spec/array/compact_blank_spec.rb
257
- - spec/array/extract_options_spec.rb
258
- - spec/array/sorted_median_spec.rb
259
- - spec/array/sorted_percentile_spec.rb
260
- - spec/array/sorted_sample_spec.rb
261
- - spec/datetime/flat_spec.rb
262
- - spec/datetime/parse_spec.rb
263
- - spec/dsl_object_spec.rb
264
- - spec/enumerable/sum_spec.rb
265
- - spec/hash/compact_spec.rb
266
- - spec/hash/deep_compact_spec.rb
267
- - spec/hash/deep_merge_spec.rb
268
- - spec/hash/indifferent_access_spec.rb
269
- - spec/hash/keys_spec.rb
270
- - spec/hash/reverse_merge_spec.rb
271
- - spec/hash/slice_spec.rb
272
- - spec/hash/zip_spec.rb
273
- - spec/hashlike/behave_same_as_hash_spec.rb
274
- - spec/hashlike/deep_hash_spec.rb
275
- - spec/hashlike/hashlike_behavior_spec.rb
276
- - spec/hashlike/hashlike_via_accessors_spec.rb
277
- - spec/hashlike_spec.rb
278
- - spec/logger/log_spec.rb
279
- - spec/metaprogramming/aliasing_spec.rb
280
- - spec/metaprogramming/cattr_accessor_spec.rb
281
- - spec/metaprogramming/class_attribute_spec.rb
282
- - spec/metaprogramming/delegation_spec.rb
283
- - spec/metaprogramming/mattr_accessor_spec.rb
284
- - spec/metaprogramming/singleton_class_spec.rb
285
- - spec/numeric/clamp_spec.rb
286
- - spec/object/blank_spec.rb
287
- - spec/object/try_dup_spec.rb
288
- - spec/object/try_spec.rb
289
- - spec/receiver/acts_as_hash_spec.rb
290
- - spec/receiver_spec.rb
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/string/constantize_spec.rb
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
@@ -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