acts_as_integer_infinitable 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79708439d0e627a03618fcb0dda176952fe51b49
4
- data.tar.gz: 9fd78e314e691b1a7bfcd1347c395cb4ea95aa3b
3
+ metadata.gz: 886b6b7a0f01032c3efa722df9b288db82b496fd
4
+ data.tar.gz: fa0bb3f6bd13412b903d9269778836db154aac7f
5
5
  SHA512:
6
- metadata.gz: b119a9836f68d08750744567b807107f0526659a14cdb70d85f02b5a0182858cbf01cff5a01de8e977e7e0e61b38e9f47debd2fbe446ff7c4a3e66b56498e204
7
- data.tar.gz: 360a65fc332659073f4b653290171b185c7d847905a93a42c83b01dcba2454e4e30cb529f17e55701918748bdb0925f99711bfe043e9d645f0ade76bd31db518
6
+ metadata.gz: 504a445947cb0878e45173f2203ef27da0c9d7d2d802e3c569d76cd0d8384c87c5669a35766b81373a904f46284de6fc6a96791a39fe571ed68093c39c2b5032
7
+ data.tar.gz: 626fbf4e65404b4c2a84bc0a3f37292986d6dfc3d6d72285b74201d33ef2d5f32dbde9070fa57fad947ac439db3b05468d08b358d717bcfb5edf8bacaae01f2b
@@ -1,3 +1,3 @@
1
1
  module ActsAsIntegerInfinitable
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -3199,3 +3199,181 @@ ActsAsIntegerInfinitableTest: test_works_on_multiple_fields
3199
3199
  SQL (0.3ms) INSERT INTO "tireless_warriors" ("attacks_available", "created_at", "movements_available", "updated_at") VALUES (?, ?, ?, ?) [["attacks_available", -1], ["created_at", "2015-06-22 05:36:51.506306"], ["movements_available", -1], ["updated_at", "2015-06-22 05:36:51.506306"]]
3200
3200
   (0.1ms) RELEASE SAVEPOINT active_record_1
3201
3201
   (0.1ms) rollback transaction
3202
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3203
+  (0.1ms) begin transaction
3204
+ ---------------------------------------------------------------------------
3205
+ ActsAsIntegerInfinitableTest: test_a_number_after_saving_should_be_the_same
3206
+ ---------------------------------------------------------------------------
3207
+  (0.1ms) SAVEPOINT active_record_1
3208
+ SQL (0.7ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", 5], ["created_at", "2015-06-24 03:38:00.749405"], ["updated_at", "2015-06-24 03:38:00.749405"]]
3209
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3210
+ LibrarySubscription Load (0.3ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3211
+  (0.3ms) rollback transaction
3212
+  (0.1ms) begin transaction
3213
+ ------------------------------------------------------------
3214
+ ActsAsIntegerInfinitableTest: test_a_number_should_decrement
3215
+ ------------------------------------------------------------
3216
+  (0.1ms) SAVEPOINT active_record_1
3217
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", 5], ["created_at", "2015-06-24 03:38:00.817888"], ["updated_at", "2015-06-24 03:38:00.817888"]]
3218
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3219
+  (0.0ms) SAVEPOINT active_record_1
3220
+ SQL (0.2ms) UPDATE "library_subscriptions" SET "available_books" = ?, "updated_at" = ? WHERE "library_subscriptions"."id" = 1 [["available_books", 4], ["updated_at", "2015-06-24 03:38:00.819194"]]
3221
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3222
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3223
+  (0.1ms) rollback transaction
3224
+  (0.0ms) begin transaction
3225
+ ---------------------------------------------------------------------------------------------------------
3226
+ ActsAsIntegerInfinitableTest: test_assign_infinity_to_existing_instace_should_be_infinity_after_reloading
3227
+ ---------------------------------------------------------------------------------------------------------
3228
+  (0.0ms) SAVEPOINT active_record_1
3229
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2015-06-24 03:38:00.821685"], ["updated_at", "2015-06-24 03:38:00.821685"]]
3230
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3231
+  (0.0ms) SAVEPOINT active_record_1
3232
+ SQL (0.1ms) UPDATE "library_subscriptions" SET "available_books" = ?, "updated_at" = ? WHERE "library_subscriptions"."id" = 1 [["available_books", -1], ["updated_at", "2015-06-24 03:38:00.822721"]]
3233
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3234
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3235
+  (0.1ms) rollback transaction
3236
+  (0.0ms) begin transaction
3237
+ ---------------------------------------------------------------------------------
3238
+ ActsAsIntegerInfinitableTest: test_assing_infinity_on_creation_should_be_infinity
3239
+ ---------------------------------------------------------------------------------
3240
+  (0.0ms) SAVEPOINT active_record_1
3241
+ SQL (0.1ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", -1], ["created_at", "2015-06-24 03:38:00.824545"], ["updated_at", "2015-06-24 03:38:00.824545"]]
3242
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3243
+  (0.1ms) rollback transaction
3244
+  (0.0ms) begin transaction
3245
+ -------------------------------------------------------------------------------------------------
3246
+ ActsAsIntegerInfinitableTest: test_assing_infinity_on_creation_should_be_infinity_after_reloading
3247
+ -------------------------------------------------------------------------------------------------
3248
+  (0.0ms) SAVEPOINT active_record_1
3249
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", -1], ["created_at", "2015-06-24 03:38:00.826017"], ["updated_at", "2015-06-24 03:38:00.826017"]]
3250
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3251
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3252
+  (0.1ms) rollback transaction
3253
+  (0.0ms) begin transaction
3254
+ -------------------------------------------------------------------------
3255
+ ActsAsIntegerInfinitableTest: test_can_define_different_value_as_infinity
3256
+ -------------------------------------------------------------------------
3257
+  (0.1ms) SAVEPOINT active_record_1
3258
+ SQL (0.3ms) INSERT INTO "people" ("created_at", "funds", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-06-24 03:38:00.872237"], ["funds", 0], ["updated_at", "2015-06-24 03:38:00.872237"]]
3259
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3260
+  (0.0ms) SAVEPOINT active_record_1
3261
+ SQL (0.2ms) INSERT INTO "people" ("created_at", "funds", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-06-24 03:38:00.879439"], ["funds", -1], ["updated_at", "2015-06-24 03:38:00.879439"]]
3262
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3263
+  (0.0ms) SAVEPOINT active_record_1
3264
+ SQL (0.1ms) INSERT INTO "people" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2015-06-24 03:38:00.880806"], ["updated_at", "2015-06-24 03:38:00.880806"]]
3265
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3266
+  (0.1ms) rollback transaction
3267
+  (0.0ms) begin transaction
3268
+ -----------------------------------------------------------------------------
3269
+ ActsAsIntegerInfinitableTest: test_infinity_after_decrement_should_not_change
3270
+ -----------------------------------------------------------------------------
3271
+  (0.0ms) SAVEPOINT active_record_1
3272
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", -1], ["created_at", "2015-06-24 03:38:00.882450"], ["updated_at", "2015-06-24 03:38:00.882450"]]
3273
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3274
+  (0.0ms) SAVEPOINT active_record_1
3275
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3276
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3277
+  (0.1ms) rollback transaction
3278
+  (0.0ms) begin transaction
3279
+ ----------------------------------------
3280
+ ActsAsIntegerInfinitableTest: test_truth
3281
+ ----------------------------------------
3282
+  (0.0ms) rollback transaction
3283
+  (0.0ms) begin transaction
3284
+ -----------------------------------------------------------
3285
+ ActsAsIntegerInfinitableTest: test_works_on_multiple_fields
3286
+ -----------------------------------------------------------
3287
+  (0.1ms) SAVEPOINT active_record_1
3288
+ SQL (0.2ms) INSERT INTO "tireless_warriors" ("attacks_available", "created_at", "movements_available", "updated_at") VALUES (?, ?, ?, ?) [["attacks_available", -1], ["created_at", "2015-06-24 03:38:00.897147"], ["movements_available", -1], ["updated_at", "2015-06-24 03:38:00.897147"]]
3289
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3290
+  (0.1ms) rollback transaction
3291
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3292
+  (0.1ms) begin transaction
3293
+ ---------------------------------------------------------------------------
3294
+ ActsAsIntegerInfinitableTest: test_a_number_after_saving_should_be_the_same
3295
+ ---------------------------------------------------------------------------
3296
+  (0.0ms) SAVEPOINT active_record_1
3297
+ SQL (0.4ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", 5], ["created_at", "2015-06-24 03:38:45.259030"], ["updated_at", "2015-06-24 03:38:45.259030"]]
3298
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3299
+ LibrarySubscription Load (0.1ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3300
+  (0.2ms) rollback transaction
3301
+  (0.1ms) begin transaction
3302
+ ------------------------------------------------------------
3303
+ ActsAsIntegerInfinitableTest: test_a_number_should_decrement
3304
+ ------------------------------------------------------------
3305
+  (0.0ms) SAVEPOINT active_record_1
3306
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", 5], ["created_at", "2015-06-24 03:38:45.268334"], ["updated_at", "2015-06-24 03:38:45.268334"]]
3307
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3308
+  (0.0ms) SAVEPOINT active_record_1
3309
+ SQL (0.2ms) UPDATE "library_subscriptions" SET "available_books" = ?, "updated_at" = ? WHERE "library_subscriptions"."id" = 1 [["available_books", 4], ["updated_at", "2015-06-24 03:38:45.269545"]]
3310
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3311
+ LibrarySubscription Load (0.1ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3312
+  (0.2ms) rollback transaction
3313
+  (0.0ms) begin transaction
3314
+ ---------------------------------------------------------------------------------------------------------
3315
+ ActsAsIntegerInfinitableTest: test_assign_infinity_to_existing_instace_should_be_infinity_after_reloading
3316
+ ---------------------------------------------------------------------------------------------------------
3317
+  (0.0ms) SAVEPOINT active_record_1
3318
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2015-06-24 03:38:45.272644"], ["updated_at", "2015-06-24 03:38:45.272644"]]
3319
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3320
+  (0.0ms) SAVEPOINT active_record_1
3321
+ SQL (0.1ms) UPDATE "library_subscriptions" SET "available_books" = ?, "updated_at" = ? WHERE "library_subscriptions"."id" = 1 [["available_books", -1], ["updated_at", "2015-06-24 03:38:45.273704"]]
3322
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3323
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3324
+  (0.1ms) rollback transaction
3325
+  (0.0ms) begin transaction
3326
+ ---------------------------------------------------------------------------------
3327
+ ActsAsIntegerInfinitableTest: test_assing_infinity_on_creation_should_be_infinity
3328
+ ---------------------------------------------------------------------------------
3329
+  (0.0ms) SAVEPOINT active_record_1
3330
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", -1], ["created_at", "2015-06-24 03:38:45.275996"], ["updated_at", "2015-06-24 03:38:45.275996"]]
3331
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3332
+  (0.1ms) rollback transaction
3333
+  (0.0ms) begin transaction
3334
+ -------------------------------------------------------------------------------------------------
3335
+ ActsAsIntegerInfinitableTest: test_assing_infinity_on_creation_should_be_infinity_after_reloading
3336
+ -------------------------------------------------------------------------------------------------
3337
+  (0.0ms) SAVEPOINT active_record_1
3338
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", -1], ["created_at", "2015-06-24 03:38:45.277813"], ["updated_at", "2015-06-24 03:38:45.277813"]]
3339
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3340
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3341
+  (0.1ms) rollback transaction
3342
+  (0.1ms) begin transaction
3343
+ -------------------------------------------------------------------------
3344
+ ActsAsIntegerInfinitableTest: test_can_define_different_value_as_infinity
3345
+ -------------------------------------------------------------------------
3346
+  (0.0ms) SAVEPOINT active_record_1
3347
+ SQL (0.3ms) INSERT INTO "people" ("created_at", "funds", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-06-24 03:38:45.282475"], ["funds", 0], ["updated_at", "2015-06-24 03:38:45.282475"]]
3348
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3349
+  (0.0ms) SAVEPOINT active_record_1
3350
+ SQL (0.1ms) INSERT INTO "people" ("created_at", "funds", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-06-24 03:38:45.287007"], ["funds", -1], ["updated_at", "2015-06-24 03:38:45.287007"]]
3351
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3352
+  (0.0ms) SAVEPOINT active_record_1
3353
+ SQL (0.1ms) INSERT INTO "people" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2015-06-24 03:38:45.288247"], ["updated_at", "2015-06-24 03:38:45.288247"]]
3354
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3355
+  (0.1ms) rollback transaction
3356
+  (0.0ms) begin transaction
3357
+ -----------------------------------------------------------------------------
3358
+ ActsAsIntegerInfinitableTest: test_infinity_after_decrement_should_not_change
3359
+ -----------------------------------------------------------------------------
3360
+  (0.1ms) SAVEPOINT active_record_1
3361
+ SQL (0.2ms) INSERT INTO "library_subscriptions" ("available_books", "created_at", "updated_at") VALUES (?, ?, ?) [["available_books", -1], ["created_at", "2015-06-24 03:38:45.290271"], ["updated_at", "2015-06-24 03:38:45.290271"]]
3362
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3363
+  (0.0ms) SAVEPOINT active_record_1
3364
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3365
+ LibrarySubscription Load (0.0ms) SELECT "library_subscriptions".* FROM "library_subscriptions" WHERE "library_subscriptions"."id" = ? LIMIT 1 [["id", 1]]
3366
+  (0.1ms) rollback transaction
3367
+  (0.0ms) begin transaction
3368
+ ----------------------------------------
3369
+ ActsAsIntegerInfinitableTest: test_truth
3370
+ ----------------------------------------
3371
+  (0.0ms) rollback transaction
3372
+  (0.1ms) begin transaction
3373
+ -----------------------------------------------------------
3374
+ ActsAsIntegerInfinitableTest: test_works_on_multiple_fields
3375
+ -----------------------------------------------------------
3376
+  (0.0ms) SAVEPOINT active_record_1
3377
+ SQL (0.3ms) INSERT INTO "tireless_warriors" ("attacks_available", "created_at", "movements_available", "updated_at") VALUES (?, ?, ?, ?) [["attacks_available", -1], ["created_at", "2015-06-24 03:38:45.296198"], ["movements_available", -1], ["updated_at", "2015-06-24 03:38:45.296198"]]
3378
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3379
+  (0.1ms) rollback transaction
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_integer_infinitable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo González Alba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.8
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.1.8
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -48,7 +48,6 @@ executables: []
48
48
  extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
51
- - README.rdoc
52
51
  - Rakefile
53
52
  - lib/acts_as_integer_infinitable.rb
54
53
  - lib/acts_as_integer_infinitable/version.rb
data/README.rdoc DELETED
@@ -1,63 +0,0 @@
1
- # ActsAsIntegerInfinitable
2
-
3
- Allows the fields to store an Infinity value.
4
-
5
- Overrides the setter and getter of those fields in order to capture
6
- and return Infinity when appropiate.
7
-
8
- Then you can use it as any other value and get the desired result, like
9
- decrementing, incrementing, comparing with <, >, ==, etc.
10
-
11
- It sets and specific value in the database (like -1, 0 or nil) to use as Infinity.
12
-
13
- ## Installation
14
-
15
- To use it, add it to your Gemfile:
16
-
17
- ```ruby
18
- gem 'acts_as_integer_infinitable'
19
- ```
20
-
21
- and bundle:
22
-
23
- ```shell
24
- bundle
25
- ```
26
-
27
- ## Usage
28
-
29
- Example:
30
- ```ruby
31
- class LibrarySubscription < ActiveRecord::Base
32
- acts_as_integer_infinitable [:available_books]
33
-
34
- def rent_book
35
- #Do other things...
36
- self.available_books -= 1
37
- save
38
- end
39
- end
40
-
41
- > simple_subscription = LibrarySubscription.new(available_books: 5)
42
- > simple_subscription.available_books
43
- => 5
44
- > simple_subscription.rent_book
45
- > simple_subscription.available_books
46
- => 4
47
-
48
- > complete_subscription = LibrarySubscription.new(available_books: Float::INFINITY)
49
- > long_subscription.available_books
50
- => Infinity
51
- > long_subscription.rent_book
52
- > long_subscription.available_books
53
- => Infinity
54
- ```
55
-
56
- ## Contributing
57
-
58
- Pull request are welcome!
59
-
60
- ## License
61
-
62
- See [LICENSE](https://github.com/pablogonzalezalba/acts_as_integer_infinitable/blob/master/LICENSE)
63
-