scratch 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Scratch
2
+
3
+ After seeing a presentation (by [Gary Haran]) on Rails engines and
4
+ reading a [certain blog post], I decided that enough was enough! I had
5
+ some Rails induced itches that needed some much needed relief. Thus here
6
+ is Scratch, a library which tries to fix a bunch of Rails' most
7
+ insignificant shortcomings.
8
+
9
+ ## Features
10
+
11
+ * The normalize model mixin
12
+ * A few core extensions
13
+
14
+ ## Installation
15
+
16
+ Simply add Scratch to your Gemfile and bundle it up:
17
+
18
+ ```ruby
19
+ gem 'scratch'
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Mixins (or Concerns if you prefer the Rails vocabulary)
25
+
26
+ These mixins are included in ActiveRecord with this gem, they could
27
+ (theoretically) be used inside any other classes, but this hasn't been
28
+ tested (nor documented) yet.
29
+
30
+ #### Normalize
31
+
32
+ The `normalize` method help you create callbacks to normalize some
33
+ attributes in a simple declarative manner.
34
+
35
+ Say you'd like to set all blank attributes to nil before validation, you
36
+ could do:
37
+
38
+ ```ruby
39
+ normalize before: :validation, when: :blank?, set: nil
40
+ ```
41
+
42
+ The `before` option default to `:validation` so it can be omitted in
43
+ that case. You can also pass a block to `normalize` that will be given
44
+ the value of the attribute and should return it's normalized form:
45
+
46
+ ```ruby
47
+ normalize { |value| value.strip }
48
+ ```
49
+
50
+ The block in that example is a common pattern that can be replaced by
51
+ the `method` option:
52
+
53
+ ```ruby
54
+ normalize method: :strip
55
+ ```
56
+
57
+ There's two specialized mixins which are variant of the above
58
+ examples...
59
+
60
+ ##### Stripify
61
+
62
+ The `stripify` method will strip all attributes, it also support all of
63
+ normalize options. Here's an example using the `except` option:
64
+
65
+ ```ruby
66
+ stripify except: :foo
67
+ ```
68
+
69
+ ##### Nilify
70
+
71
+ Don't like odd numbers, here's a solution:
72
+
73
+ ```ruby
74
+ nilify only: [:foo, :bar], when: :odd?, before: :save
75
+ ```
76
+
77
+ ### Core Extensions
78
+
79
+ #### Array
80
+
81
+ Want to use `join` for user facing stuff but doesn't want to clean up
82
+ the array yourself, use `strip_join`:
83
+
84
+ ```ruby
85
+ [1, 2, nil, '', ' ' , ' 3 '].strip_join ', '
86
+ #=> "1, 2, 3"
87
+ ```
88
+
89
+ #### Hash
90
+
91
+ Have many keys to look-up and need the first one available, use `fetch_or`:
92
+
93
+ ```ruby
94
+ h = { a: 1, b: 2, c: 3 }
95
+ h.fetch_or :e, :d, :c
96
+ #=> 3
97
+ # also support a `default` option...
98
+ h.fetch_or :x, :y, :z, default: nil
99
+ #=> nil
100
+ # when no default is given, act like `fetch` and raise a `KeyError`
101
+ ```
102
+
103
+ You're stuck with a hash having arrays as values and need to invert it?
104
+
105
+ ```ruby
106
+ h = { west_coast: %w(WA OR CA AZ), east_east: %w(ME VT NY NJ) }
107
+ y = h.invert_splat
108
+ y['NJ']
109
+ #=> :east_coast
110
+ ```
111
+
112
+ ## License
113
+
114
+ This project rocks and uses MIT-LICENSE!
115
+
116
+ [Gary Haran]: https://github.com/garyharan
117
+ [certain blog post]: http://gilesbowkett.blogspot.in/2012/02/rails-went-off-rails-why-im-rebuilding.html
@@ -7,13 +7,13 @@ module Scratch::Concerns::Nilify
7
7
  def nilify(options = {})
8
8
  options = HashWithIndifferentAccess.new options
9
9
 
10
- options[:before] ||= :validation
11
- options[:predicate] ||= :blank?
12
- options[:name] ||=
13
- "nilify_before_#{options[:before]}_if_#{options[:predicate]}"
10
+ options[:before] ||= :validation
11
+ options[:when] ||= :blank?
12
+ options[:name] ||=
13
+ "nilify_before_#{options[:before]}_when_#{options[:when]}"
14
14
 
15
15
  instance_eval do
16
- normalize options.merge(default: nil)
16
+ normalize options.merge(set: nil)
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,4 @@
1
+ require 'scratch/utils'
1
2
 
2
3
  # == Normalize Callbacks
3
4
  #
@@ -14,12 +15,6 @@ module Scratch::Concerns::Normalize
14
15
  if self == ActiveRecord::Base
15
16
  -> base { base.content_columns.map(&:name) }
16
17
  end
17
-
18
- cattr_accessor :normalize_default_callback_format
19
- self.normalize_default_callback_format =
20
- if self == ActiveRecord::Base
21
- 'before_%s'
22
- end
23
18
  end
24
19
 
25
20
  module ClassMethods
@@ -27,28 +22,37 @@ module Scratch::Concerns::Normalize
27
22
  callback_options = HashWithIndifferentAccess.new options
28
23
 
29
24
  options = callback_options.slice!(:if, :unless)
30
- default = options[:default]
25
+ set = options[:set]
31
26
  method = options[:method]
32
- predicate = Array.wrap options[:predicate]
33
- callback = options.fetch_or(:before, :after, :callback,
34
- default: :validation)
27
+ predicate = Array.wrap options[:when]
28
+
29
+ trigger_format = options[:trigger_format] || '%s_%s'
35
30
 
36
- callback_method = options[:name] ||
37
- "normalize_before_#{callback}" +
38
- (predicate.empty? ? '' : "_when_#{predicate}")
31
+ trigger = options[:trigger] ||
32
+ (options[:before] ? trigger_format % [:before , options[:before]] :
33
+ options[:after] ? trigger_format % [:after , options[:after]] :
34
+ raise(ArgumentError, 'missing option, you must specify one of: ' +
35
+ 'before, after or trigger'))
36
+
37
+ unless options.has_key?(:set) || method || block_given?
38
+ raise(ArgumentError, 'missing option or block, ' +
39
+ 'you must give a block or specify one of: set or method')
40
+ end
41
+
42
+ callback = options[:name] || Scratch::Utils.gensym
39
43
 
40
44
  attributes = options[:attributes] ||
41
45
  Scratch::Options
42
46
  .except_only(options, normalize_default_attributes_source[self])
43
47
 
44
48
  instance_eval do
45
- define_method callback_method do
49
+ define_method callback do
46
50
  attributes.each do |attribute|
47
51
  value = send(attribute)
48
52
  if predicate.empty? || value.send(*predicate)
49
53
  value =
50
- if options.has_key? :default
51
- default
54
+ if options.has_key? :set
55
+ set
52
56
  elsif method
53
57
  value.send method
54
58
  else
@@ -61,11 +65,7 @@ module Scratch::Concerns::Normalize
61
65
  end
62
66
  end
63
67
 
64
- callback_format = options[:callback_format] ||
65
- normalize_default_callback_format
66
-
67
- callback = callback_format ? callback_format % callback : callback
68
- send callback, callback_method
68
+ send trigger, callback
69
69
  end
70
70
  end
71
71
 
@@ -0,0 +1,9 @@
1
+ require 'securerandom'
2
+
3
+ module Scratch::Utils
4
+
5
+ def self.gensym
6
+ ('_' + SecureRandom.uuid.gsub('-', '_')).to_sym
7
+ end
8
+
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Scratch
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -2,6 +2,6 @@
2
2
  class NilifyTestModel < ActiveRecord::Base
3
3
 
4
4
  nilify except: [:foo, :baz]
5
- nilify only: :baz, predicate: :odd?, before: :save
5
+ nilify only: :baz, when: :odd?, before: :save
6
6
 
7
7
  end
@@ -0,0 +1,18 @@
1
+
2
+ class NormalizeTestModel < ActiveRecord::Base
3
+
4
+ normalize(after: :save,
5
+ only: :foo,
6
+ set: 'foo',
7
+ name: :normalize_after_save)
8
+
9
+ normalize(before: :validation,
10
+ only: :bar,
11
+ set: 0)
12
+
13
+ normalize(trigger: :before_save,
14
+ only: :baz) do |value|
15
+ value * 2
16
+ end
17
+
18
+ end
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateNormalizeTestModels < ActiveRecord::Migration
2
+ def change
3
+ create_table :normalize_test_models do |t|
4
+ t.string :foo
5
+ t.integer :bar
6
+ t.text :baz
7
+ end
8
+ end
9
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120226052737) do
14
+ ActiveRecord::Schema.define(:version => 20120329194042) do
15
15
 
16
16
  create_table "nilify_test_models", :force => true do |t|
17
17
  t.string "foo"
@@ -19,6 +19,12 @@ ActiveRecord::Schema.define(:version => 20120226052737) do
19
19
  t.integer "baz"
20
20
  end
21
21
 
22
+ create_table "normalize_test_models", :force => true do |t|
23
+ t.string "foo"
24
+ t.integer "bar"
25
+ t.text "baz"
26
+ end
27
+
22
28
  create_table "stripify_test_models", :force => true do |t|
23
29
  t.string "foo"
24
30
  t.string "bar"
Binary file
@@ -113,3 +113,91 @@ Migrating to CreateStripifyTestModels (20120226052737)
113
113
   (0.3ms) SELECT version FROM "schema_migrations"
114
114
   (29.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
115
115
   (21.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226002304')
116
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
117
+ Migrating to CreateNilifyTestModels (20120226002304)
118
+ Migrating to CreateStripifyTestModels (20120226052737)
119
+ Migrating to CreateNormalizeTestModels (20120329194042)
120
+  (0.1ms) select sqlite_version(*)
121
+  (0.1ms) begin transaction
122
+  (1.9ms) CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
123
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120329194042')
124
+  (36.6ms) commit transaction
125
+  (0.2ms) select sqlite_version(*)
126
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
127
+  (0.0ms) PRAGMA index_list("nilify_test_models")
128
+  (0.0ms) PRAGMA index_list("normalize_test_models")
129
+  (0.0ms) PRAGMA index_list("stripify_test_models")
130
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
131
+  (0.2ms) select sqlite_version(*)
132
+  (30.2ms) CREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) 
133
+  (29.9ms) CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
134
+  (29.0ms) CREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) 
135
+  (19.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
136
+  (0.1ms) PRAGMA index_list("schema_migrations")
137
+  (19.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
138
+  (0.1ms) SELECT version FROM "schema_migrations"
139
+  (25.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
140
+  (28.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226002304')
141
+  (24.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
142
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
143
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
144
+ Migrating to CreateNormalizeTestModels (20120329194042)
145
+  (0.0ms) select sqlite_version(*)
146
+  (0.0ms) begin transaction
147
+  (0.3ms) DROP TABLE "normalize_test_models"
148
+  (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = '20120329194042'
149
+  (39.3ms) commit transaction
150
+  (0.2ms) select sqlite_version(*)
151
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
152
+  (0.0ms) PRAGMA index_list("nilify_test_models")
153
+  (0.0ms) PRAGMA index_list("stripify_test_models")
154
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
155
+ Migrating to CreateNilifyTestModels (20120226002304)
156
+ Migrating to CreateStripifyTestModels (20120226052737)
157
+ Migrating to CreateNormalizeTestModels (20120329194042)
158
+  (0.1ms) select sqlite_version(*)
159
+  (0.0ms) begin transaction
160
+  (0.3ms) CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
161
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120329194042')
162
+  (22.6ms) commit transaction
163
+  (0.2ms) select sqlite_version(*)
164
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
165
+  (0.0ms) PRAGMA index_list("nilify_test_models")
166
+  (0.0ms) PRAGMA index_list("normalize_test_models")
167
+  (0.0ms) PRAGMA index_list("stripify_test_models")
168
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
169
+  (0.3ms) select sqlite_version(*)
170
+  (19.8ms) CREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) 
171
+  (15.7ms) CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
172
+  (27.5ms) CREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) 
173
+  (25.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
174
+  (0.1ms) PRAGMA index_list("schema_migrations")
175
+  (16.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
176
+  (0.1ms) SELECT version FROM "schema_migrations"
177
+  (19.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
178
+  (27.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226002304')
179
+  (25.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
180
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
181
+  (0.3ms) select sqlite_version(*)
182
+  (31.1ms) CREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) 
183
+  (23.5ms) CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
184
+  (20.5ms) CREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) 
185
+  (24.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
186
+  (0.1ms) PRAGMA index_list("schema_migrations")
187
+  (26.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
188
+  (0.1ms) SELECT version FROM "schema_migrations"
189
+  (21.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
190
+  (16.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226002304')
191
+  (28.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
192
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
193
+  (0.2ms) select sqlite_version(*)
194
+  (29.5ms) CREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) 
195
+  (24.8ms) CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
196
+  (18.6ms) CREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) 
197
+  (28.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
198
+  (0.1ms) PRAGMA index_list("schema_migrations")
199
+  (25.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
200
+  (0.1ms) SELECT version FROM "schema_migrations"
201
+  (17.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
202
+  (17.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226002304')
203
+  (24.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
@@ -292,3 +292,298 @@
292
292
  SQL (26.1ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 22
293
293
   (0.1ms) begin transaction
294
294
   (0.0ms) rollback transaction
295
+  (0.1ms) begin transaction
296
+ SQL (4.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
297
+  (42.4ms) commit transaction
298
+ SQL (23.1ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 23
299
+  (0.1ms) begin transaction
300
+  (0.1ms) rollback transaction
301
+  (0.1ms) begin transaction
302
+ SQL (2.3ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
303
+  (25.0ms) commit transaction
304
+ SQL (16.1ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 24
305
+  (0.1ms) begin transaction
306
+  (0.0ms) rollback transaction
307
+  (0.1ms) begin transaction
308
+ SQL (3.0ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
309
+  (28.6ms) commit transaction
310
+ SQL (27.6ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 25
311
+  (0.1ms) begin transaction
312
+  (0.1ms) rollback transaction
313
+  (0.1ms) begin transaction
314
+ SQL (3.4ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
315
+  (29.6ms) commit transaction
316
+ SQL (27.6ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 1
317
+  (0.1ms) begin transaction
318
+  (0.0ms) rollback transaction
319
+  (0.1ms) begin transaction
320
+ SQL (2.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
321
+  (21.3ms) commit transaction
322
+ SQL (25.0ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 2
323
+  (0.1ms) begin transaction
324
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
325
+  (27.1ms) commit transaction
326
+ SQL (22.2ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 1
327
+  (0.1ms) begin transaction
328
+  (0.0ms) rollback transaction
329
+  (0.1ms) begin transaction
330
+ SQL (2.7ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
331
+  (25.9ms) commit transaction
332
+ SQL (18.0ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 3
333
+  (0.1ms) begin transaction
334
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
335
+  (0.1ms) rollback transaction
336
+  (0.1ms) begin transaction
337
+  (0.0ms) rollback transaction
338
+  (0.1ms) begin transaction
339
+ SQL (2.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
340
+  (22.6ms) commit transaction
341
+ SQL (17.0ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 4
342
+  (0.1ms) begin transaction
343
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
344
+  (27.1ms) commit transaction
345
+ SQL (27.0ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 2
346
+  (0.1ms) begin transaction
347
+  (0.0ms) rollback transaction
348
+  (0.1ms) begin transaction
349
+ SQL (3.3ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
350
+  (33.1ms) commit transaction
351
+ SQL (26.0ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 5
352
+  (0.1ms) begin transaction
353
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
354
+  (21.6ms) commit transaction
355
+ SQL (15.5ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 3
356
+  (0.1ms) begin transaction
357
+  (0.0ms) rollback transaction
358
+  (0.1ms) begin transaction
359
+ SQL (2.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
360
+  (30.0ms) commit transaction
361
+ SQL (25.0ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 6
362
+  (0.1ms) begin transaction
363
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
364
+  (17.5ms) commit transaction
365
+ SQL (17.6ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 4
366
+  (0.1ms) begin transaction
367
+  (0.0ms) rollback transaction
368
+  (0.1ms) begin transaction
369
+ SQL (2.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
370
+  (23.9ms) commit transaction
371
+ SQL (30.7ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 7
372
+  (0.1ms) begin transaction
373
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
374
+  (24.4ms) commit transaction
375
+ SQL (17.3ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 5
376
+  (0.1ms) begin transaction
377
+  (0.0ms) rollback transaction
378
+  (0.1ms) begin transaction
379
+ SQL (2.8ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
380
+  (31.1ms) commit transaction
381
+ SQL (25.6ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 8
382
+  (0.1ms) begin transaction
383
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
384
+  (17.1ms) commit transaction
385
+ SQL (16.2ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 6
386
+  (0.1ms) begin transaction
387
+  (0.0ms) rollback transaction
388
+  (0.1ms) begin transaction
389
+ SQL (2.4ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
390
+  (30.5ms) commit transaction
391
+ SQL (27.1ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 9
392
+  (0.1ms) begin transaction
393
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
394
+  (22.4ms) commit transaction
395
+ SQL (16.5ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 7
396
+  (0.1ms) begin transaction
397
+  (0.0ms) rollback transaction
398
+  (0.1ms) begin transaction
399
+ SQL (2.6ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
400
+  (22.4ms) commit transaction
401
+ SQL (27.2ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 10
402
+  (0.1ms) begin transaction
403
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
404
+  (25.1ms) commit transaction
405
+ SQL (21.0ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 8
406
+  (0.1ms) begin transaction
407
+  (0.0ms) rollback transaction
408
+  (0.1ms) begin transaction
409
+ SQL (2.0ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
410
+  (25.7ms) commit transaction
411
+ SQL (26.8ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 11
412
+  (0.1ms) begin transaction
413
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
414
+  (26.2ms) commit transaction
415
+ SQL (17.1ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 9
416
+  (0.1ms) begin transaction
417
+  (0.0ms) rollback transaction
418
+  (0.1ms) begin transaction
419
+ SQL (2.4ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
420
+  (21.6ms) commit transaction
421
+ SQL (23.7ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 12
422
+  (0.1ms) begin transaction
423
+ SQL (0.3ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
424
+  (28.9ms) commit transaction
425
+ SQL (26.1ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 10
426
+  (0.1ms) begin transaction
427
+  (0.0ms) rollback transaction
428
+  (0.1ms) begin transaction
429
+ SQL (2.3ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
430
+  (26.5ms) commit transaction
431
+ SQL (16.4ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 13
432
+  (0.1ms) begin transaction
433
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
434
+  (16.3ms) commit transaction
435
+ SQL (29.0ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 11
436
+  (0.1ms) begin transaction
437
+  (0.0ms) rollback transaction
438
+  (0.1ms) begin transaction
439
+ SQL (2.9ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
440
+  (26.7ms) commit transaction
441
+ SQL (28.9ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 14
442
+  (0.1ms) begin transaction
443
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
444
+  (25.1ms) commit transaction
445
+ SQL (18.3ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 12
446
+  (0.1ms) begin transaction
447
+  (0.0ms) rollback transaction
448
+  (0.1ms) begin transaction
449
+ SQL (2.6ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
450
+  (25.4ms) commit transaction
451
+ SQL (26.6ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 15
452
+  (0.1ms) begin transaction
453
+ SQL (0.3ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
454
+  (24.9ms) commit transaction
455
+ SQL (20.8ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 13
456
+  (0.1ms) begin transaction
457
+  (0.0ms) rollback transaction
458
+  (0.1ms) begin transaction
459
+ SQL (2.6ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
460
+  (21.0ms) commit transaction
461
+ SQL (28.9ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 16
462
+  (0.2ms) begin transaction
463
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
464
+  (25.1ms) commit transaction
465
+ SQL (17.8ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 14
466
+  (0.1ms) begin transaction
467
+  (0.1ms) rollback transaction
468
+  (0.1ms) begin transaction
469
+  (0.1ms) rollback transaction
470
+  (0.1ms) begin transaction
471
+  (0.1ms) rollback transaction
472
+  (0.1ms) begin transaction
473
+  (0.1ms) rollback transaction
474
+  (0.1ms) begin transaction
475
+ SQL (2.2ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
476
+  (43.7ms) commit transaction
477
+ SQL (27.7ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 17
478
+  (0.1ms) begin transaction
479
+  (0.1ms) rollback transaction
480
+  (0.1ms) begin transaction
481
+  (0.0ms) rollback transaction
482
+  (0.1ms) begin transaction
483
+ SQL (2.3ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
484
+  (30.1ms) commit transaction
485
+ SQL (19.5ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 18
486
+  (0.1ms) begin transaction
487
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
488
+  (17.0ms) commit transaction
489
+ SQL (22.6ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 15
490
+  (0.1ms) begin transaction
491
+  (0.0ms) rollback transaction
492
+  (0.1ms) begin transaction
493
+ SQL (2.6ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
494
+  (24.3ms) commit transaction
495
+ SQL (21.1ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 19
496
+  (0.1ms) begin transaction
497
+  (0.0ms) rollback transaction
498
+  (0.1ms) begin transaction
499
+  (0.1ms) rollback transaction
500
+  (0.1ms) begin transaction
501
+ SQL (2.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
502
+  (25.5ms) commit transaction
503
+ SQL (19.2ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 20
504
+  (0.1ms) begin transaction
505
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
506
+  (28.3ms) commit transaction
507
+ SQL (24.0ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 16
508
+  (0.1ms) begin transaction
509
+  (0.2ms) rollback transaction
510
+  (0.1ms) begin transaction
511
+ SQL (3.3ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
512
+  (38.8ms) commit transaction
513
+ SQL (18.9ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 21
514
+  (0.1ms) begin transaction
515
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
516
+  (16.3ms) commit transaction
517
+ SQL (20.6ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 17
518
+  (0.1ms) begin transaction
519
+  (0.0ms) rollback transaction
520
+  (0.1ms) begin transaction
521
+ SQL (3.1ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
522
+  (33.8ms) commit transaction
523
+ SQL (17.1ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 22
524
+  (0.1ms) begin transaction
525
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
526
+  (27.3ms) commit transaction
527
+ SQL (28.3ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 18
528
+  (0.1ms) begin transaction
529
+  (0.0ms) rollback transaction
530
+  (0.1ms) begin transaction
531
+ SQL (2.7ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
532
+  (32.6ms) commit transaction
533
+ SQL (25.4ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 23
534
+  (0.1ms) begin transaction
535
+ SQL (0.3ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
536
+  (23.0ms) commit transaction
537
+ SQL (26.1ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 19
538
+  (0.1ms) begin transaction
539
+  (0.0ms) rollback transaction
540
+  (0.1ms) begin transaction
541
+ SQL (2.6ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
542
+  (29.1ms) commit transaction
543
+ SQL (22.2ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 24
544
+  (0.1ms) begin transaction
545
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
546
+  (21.0ms) commit transaction
547
+ SQL (14.6ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 20
548
+  (0.1ms) begin transaction
549
+  (0.0ms) rollback transaction
550
+  (0.1ms) begin transaction
551
+ SQL (3.1ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
552
+  (29.3ms) commit transaction
553
+ SQL (22.5ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 25
554
+  (0.1ms) begin transaction
555
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
556
+  (22.4ms) commit transaction
557
+ SQL (15.2ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 21
558
+  (0.1ms) begin transaction
559
+  (0.0ms) rollback transaction
560
+  (0.1ms) begin transaction
561
+ SQL (2.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
562
+  (20.0ms) commit transaction
563
+ SQL (25.5ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 26
564
+  (0.1ms) begin transaction
565
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
566
+  (26.5ms) commit transaction
567
+ SQL (23.0ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 22
568
+  (0.1ms) begin transaction
569
+  (0.0ms) rollback transaction
570
+  (0.1ms) begin transaction
571
+ SQL (16.5ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
572
+  (45.9ms) commit transaction
573
+ SQL (17.3ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 27
574
+  (0.1ms) begin transaction
575
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
576
+  (15.4ms) commit transaction
577
+ SQL (26.5ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 23
578
+  (0.1ms) begin transaction
579
+  (0.1ms) rollback transaction
580
+  (0.1ms) begin transaction
581
+ SQL (3.0ms) INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
582
+  (45.8ms) commit transaction
583
+ SQL (17.4ms) DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 28
584
+  (0.2ms) begin transaction
585
+ SQL (0.2ms) INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
586
+  (22.9ms) commit transaction
587
+ SQL (28.9ms) DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 24
588
+  (0.1ms) begin transaction
589
+  (0.0ms) rollback transaction
@@ -13,8 +13,8 @@ class Scratch::Concerns::NilifyTest < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  def test_callbacks_methods_are_defined
16
- assert @entity.respond_to? :nilify_before_validation_if_blank?
17
- assert @entity.respond_to? :nilify_before_save_if_odd?
16
+ assert_respond_to @entity, :nilify_before_validation_when_blank?
17
+ assert_respond_to @entity, :nilify_before_save_when_odd?
18
18
  end
19
19
 
20
20
  def test_effect_of_triggering_validation_callback
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../../test_helper.rb'
4
+
5
+ class Scratch::Concerns::NormalizeTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ @entity = NormalizeTestModel.new foo: '', bar: 1, baz: '!'
9
+ end
10
+
11
+ def teardown
12
+ @entity.delete
13
+ end
14
+
15
+ def test_must_specify_a_trigger_for_normalize
16
+ assert_raise ArgumentError do
17
+ NormalizeTestModel.class_eval { normalize }
18
+ end
19
+ end
20
+
21
+ def test_must_specify_an_action_for_normalize
22
+ assert_raise ArgumentError do
23
+ NormalizeTestModel.class_eval { normalize trigger: :foo }
24
+ end
25
+ end
26
+
27
+ def test_callbacks_methods_are_defined
28
+ assert_respond_to @entity, :normalize_after_save
29
+ end
30
+
31
+ def test_effect_of_triggering_validation_callback
32
+ @entity.valid?
33
+ assert_equal '', @entity.foo
34
+ assert_equal 0 , @entity.bar
35
+ assert_equal '!', @entity.baz
36
+ end
37
+
38
+ def test_effect_of_triggering_save_callback
39
+ @entity.save
40
+ assert_equal 'foo', @entity.foo
41
+ assert_equal 0 , @entity.bar
42
+ assert_equal '!!', @entity.baz
43
+ end
44
+
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scratch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-26 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &16623240 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16623240
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.1
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: sqlite3
27
- requirement: &16622000 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,8 +37,13 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *16622000
36
- description: A plugin to relieve from some Rails itches.
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: See README.md file.
37
47
  email:
38
48
  - nbuduroi@gmail.com
39
49
  executables: []
@@ -56,12 +66,14 @@ files:
56
66
  - lib/scratch/core_ext/hash.rb
57
67
  - lib/scratch/concerns.rb
58
68
  - lib/scratch/options.rb
69
+ - lib/scratch/utils.rb
59
70
  - lib/scratch/engine.rb
60
71
  - lib/tasks/scratch_tasks.rake
61
72
  - MIT-LICENSE
62
73
  - Rakefile
63
- - README.rdoc
74
+ - README.md
64
75
  - test/unit/concerns/nilify_test.rb
76
+ - test/unit/concerns/normalize_test.rb
65
77
  - test/unit/concerns/stripify_test.rb
66
78
  - test/unit/core_ext/array_test.rb
67
79
  - test/unit/core_ext/hash_test.rb
@@ -96,7 +108,9 @@ files:
96
108
  - test/dummy/db/test.sqlite3
97
109
  - test/dummy/db/migrate/20120226002304_create_nilify_test_models.rb
98
110
  - test/dummy/db/migrate/20120226052737_create_stripify_test_models.rb
111
+ - test/dummy/db/migrate/20120329194042_create_normalize_test_models.rb
99
112
  - test/dummy/app/models/nilify_test_model.rb
113
+ - test/dummy/app/models/normalize_test_model.rb
100
114
  - test/dummy/app/models/stripify_test_model.rb
101
115
  - test/dummy/app/helpers/application_helper.rb
102
116
  - test/dummy/app/assets/stylesheets/application.css
@@ -119,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
133
  version: '0'
120
134
  segments:
121
135
  - 0
122
- hash: 2465014890557268721
136
+ hash: -2245081140959681315
123
137
  required_rubygems_version: !ruby/object:Gem::Requirement
124
138
  none: false
125
139
  requirements:
@@ -128,15 +142,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
142
  version: '0'
129
143
  segments:
130
144
  - 0
131
- hash: 2465014890557268721
145
+ hash: -2245081140959681315
132
146
  requirements: []
133
147
  rubyforge_project:
134
- rubygems_version: 1.8.10
148
+ rubygems_version: 1.8.22
135
149
  signing_key:
136
150
  specification_version: 3
137
151
  summary: A plugin to relieve from some Rails itches.
138
152
  test_files:
139
153
  - test/unit/concerns/nilify_test.rb
154
+ - test/unit/concerns/normalize_test.rb
140
155
  - test/unit/concerns/stripify_test.rb
141
156
  - test/unit/core_ext/array_test.rb
142
157
  - test/unit/core_ext/hash_test.rb
@@ -171,7 +186,9 @@ test_files:
171
186
  - test/dummy/db/test.sqlite3
172
187
  - test/dummy/db/migrate/20120226002304_create_nilify_test_models.rb
173
188
  - test/dummy/db/migrate/20120226052737_create_stripify_test_models.rb
189
+ - test/dummy/db/migrate/20120329194042_create_normalize_test_models.rb
174
190
  - test/dummy/app/models/nilify_test_model.rb
191
+ - test/dummy/app/models/normalize_test_model.rb
175
192
  - test/dummy/app/models/stripify_test_model.rb
176
193
  - test/dummy/app/helpers/application_helper.rb
177
194
  - test/dummy/app/assets/stylesheets/application.css
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = Scratch
2
-
3
- This project rocks and uses MIT-LICENSE.