power_enum 1.3.3 → 1.3.4
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.tar.gz.sig +2 -1
- data/README.markdown +66 -61
- metadata +21 -6
- metadata.gz.sig +0 -0
- checksums.yaml +0 -15
- checksums.yaml.gz.sig +0 -0
    
        data.tar.gz.sig
    CHANGED
    
    | @@ -1 +1,2 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            ��G��p��0k���3s�1Y;&�N�5ߘq���
         | 
| 2 | 
            +
            ����k�*��Z`{��s	�POC�F�L�Sq2��f�5��q��B�"R,�CZ�,�=H>�I]T��z��v�2�'zo:�/_�|��W<�z���ғ0VN��������jNW�ܓx�n�����h��q����.*�@u��^0�֠��B{�*8jA�,l,jhP��2<��L�
         | 
    
        data/README.markdown
    CHANGED
    
    | @@ -7,8 +7,13 @@ https://github.com/albertosaurus/power_enum | |
| 7 7 |  | 
| 8 8 | 
             
            Enumerations for Rails 3.1/3.2 Done Right.
         | 
| 9 9 |  | 
| 10 | 
            +
            ## Versions
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            * PowerEnum 1.X  (this version) supports Rails 3.1/3.2.
         | 
| 13 | 
            +
            * PowerEnum 2.X supports Rails 4, available here: https://github.com/albertosaurus/power_enum_2
         | 
| 14 | 
            +
             | 
| 10 15 | 
             
            NOTICE: Version 1.0 removes support from Rails 3.0, as that version of Rails has no longer been supported for
         | 
| 11 | 
            -
            some time. | 
| 16 | 
            +
            some time. The last version to support Rails 3.0 was 0.11.1.
         | 
| 12 17 |  | 
| 13 18 | 
             
            ## What is this?:
         | 
| 14 19 |  | 
| @@ -18,7 +23,7 @@ It is particularly suitable for scenarios where your Rails application is not th | |
| 18 23 | 
             
            when it's used for analytics or reporting.
         | 
| 19 24 |  | 
| 20 25 | 
             
            Power Enum is a fork of the Rails 3 modernization made by the fine folks at Protocool
         | 
| 21 | 
            -
            https://github.com/protocool/enumerations_mixin to the original plugin by Trevor Squires. | 
| 26 | 
            +
            https://github.com/protocool/enumerations_mixin to the original plugin by Trevor Squires. While many of the core ideas
         | 
| 22 27 | 
             
            remain, it has been reworked and a full test suite written to facilitate further development.
         | 
| 23 28 |  | 
| 24 29 | 
             
            At it's most basic level, it allows you to say things along the lines of:
         | 
| @@ -52,8 +57,8 @@ See "How to use it" below for more information. | |
| 52 57 |  | 
| 53 58 | 
             
            ### READ THIS FIRST
         | 
| 54 59 |  | 
| 55 | 
            -
            Starting with version 1.1.0, the gem is signed. | 
| 56 | 
            -
            here: https://github.com/albertosaurus/power_enum (look for gem-public\_cert.pem). | 
| 60 | 
            +
            Starting with version 1.1.0, the gem is signed. The public key is available
         | 
| 61 | 
            +
            here: https://github.com/albertosaurus/power_enum (look for gem-public\_cert.pem). Hence, if
         | 
| 57 62 | 
             
            you can get an error like the following if you're installing in `HighSecurity` mode.
         | 
| 58 63 |  | 
| 59 64 | 
             
            ```
         | 
| @@ -62,7 +67,7 @@ ERROR:  While executing gem ... (RuntimeError) | |
| 62 67 | 
             
            ```
         | 
| 63 68 |  | 
| 64 69 | 
             
            If this happens, you need to add the PowerEnum public cert to your gem cert
         | 
| 65 | 
            -
            store. | 
| 70 | 
            +
            store. Download the certificate (gem-public\_cert.pem) and run the following.
         | 
| 66 71 |  | 
| 67 72 | 
             
                gem cert -a gem-public_cert.pem
         | 
| 68 73 |  | 
| @@ -97,9 +102,9 @@ This package adds: | |
| 97 102 |  | 
| 98 103 | 
             
            `acts_as_enumerated` provides capabilities to treat your model and its records as an enumeration.
         | 
| 99 104 | 
             
            At a minimum, the database table for an acts\_as\_enumerated must contain an 'id' column and a column
         | 
| 100 | 
            -
            to hold the value of the enum ('name' by default). | 
| 101 | 
            -
            a NOT NULL constraint on the 'name' column. | 
| 102 | 
            -
            are cached in memory. | 
| 105 | 
            +
            to hold the value of the enum ('name' by default). It is strongly recommended that there be
         | 
| 106 | 
            +
            a NOT NULL constraint on the 'name' column. All instances for the `acts_as_enumerated` model
         | 
| 107 | 
            +
            are cached in memory. If the table has an 'active' column, the value of that attribute
         | 
| 103 108 | 
             
            will be used to determine which enum instances are active.
         | 
| 104 109 | 
             
            Otherwise, all values are considered active.
         | 
| 105 110 |  | 
| @@ -128,9 +133,9 @@ You should see output similar to this: | |
| 128 133 | 
             
                invoke  test_unit
         | 
| 129 134 | 
             
                create    test/unit/booking_status_test.rb
         | 
| 130 135 |  | 
| 131 | 
            -
            That's all you need to get started. | 
| 132 | 
            -
            to see a description of the generator options. | 
| 133 | 
            -
            fixtures are not an ideal way to test acts\_as\_enumerated models. | 
| 136 | 
            +
            That's all you need to get started. In many cases, no further work on the enum is necessary. You can run `rails generate enum --help`
         | 
| 137 | 
            +
            to see a description of the generator options. Notice, that while a unit test is generated by default, a fixture isn't. That is because
         | 
| 138 | 
            +
            fixtures are not an ideal way to test acts\_as\_enumerated models. I generally prefer having a hook to seed the database from seeds.rb
         | 
| 134 139 | 
             
            from a pre-test Rake task.
         | 
| 135 140 |  | 
| 136 141 | 
             
            ### migration
         | 
| @@ -189,13 +194,13 @@ There are two methods added to Rails migrations: | |
| 189 194 |  | 
| 190 195 | 
             
            ##### create\_enum(enum\_name, options = {}, &block)
         | 
| 191 196 |  | 
| 192 | 
            -
            Creates a new enum table. | 
| 197 | 
            +
            Creates a new enum table. `enum_name` will be automatically pluralized. The following options are supported:
         | 
| 193 198 |  | 
| 194 | 
            -
            - [:name\_column]  Specify the column name for name of the enum. | 
| 199 | 
            +
            - [:name\_column]  Specify the column name for name of the enum. By default it's :name. This can be a String or a Symbol
         | 
| 195 200 | 
             
            - [:description]  Set this to `true` to have a 'description' column generated.
         | 
| 196 201 | 
             
            - [:name\_limit]  Set this define the limit of the name column.
         | 
| 197 202 | 
             
            - [:desc\_limit]  Set this to define the limit of the description column
         | 
| 198 | 
            -
            - [:active]  Set this to `true` to have a boolean 'active' column generated. | 
| 203 | 
            +
            - [:active]  Set this to `true` to have a boolean 'active' column generated. The 'active' column will have the options of NOT NULL and DEFAULT TRUE.
         | 
| 199 204 | 
             
            - [:timestamps]  Set this to `true` to have the timestamp columns (created\_at and updated\_at) generated
         | 
| 200 205 |  | 
| 201 206 | 
             
            You can also pass in a block that takes a table object as an argument, like `create_table`.
         | 
| @@ -261,7 +266,7 @@ Notice that a unique index is automatically created on the specified name column | |
| 261 266 |  | 
| 262 267 | 
             
            ##### remove\_enum(enum\_name)
         | 
| 263 268 |  | 
| 264 | 
            -
            Drops the enum table. | 
| 269 | 
            +
            Drops the enum table. `enum_name` will be automatically pluralized.
         | 
| 265 270 |  | 
| 266 271 | 
             
            Example:
         | 
| 267 272 |  | 
| @@ -295,29 +300,29 @@ With that, your BookingStatus class will have the following methods defined: | |
| 295 300 |  | 
| 296 301 | 
             
            ##### [](*args)
         | 
| 297 302 |  | 
| 298 | 
            -
            `BookingStatus[arg]` performs a lookup for the BookingStatus instance for the given arg. | 
| 299 | 
            -
            'string' or a :symbol, in which case the lookup will be against the BookingStatus.name field. | 
| 300 | 
            -
            a Fixnum, in which case the lookup will be against the BookingStatus.id field. | 
| 303 | 
            +
            `BookingStatus[arg]` performs a lookup for the BookingStatus instance for the given arg. The arg value can be a
         | 
| 304 | 
            +
            'string' or a :symbol, in which case the lookup will be against the BookingStatus.name field. Alternatively arg can be
         | 
| 305 | 
            +
            a Fixnum, in which case the lookup will be against the BookingStatus.id field. Since version 0.5.3, it returns the arg
         | 
| 301 306 | 
             
            if arg is an instance of the enum (in this case BookingStatus) as a convenience.
         | 
| 302 307 |  | 
| 303 308 | 
             
            The `:on_lookup_failure` option specifies the name of a *class* method to invoke when the `[]` method is unable to
         | 
| 304 | 
            -
            locate a BookingStatus record for arg. | 
| 309 | 
            +
            locate a BookingStatus record for arg. The default is the built-in `:enforce_none` which returns nil. There are also
         | 
| 305 310 | 
             
            built-ins for `:enforce_strict` (raise and exception regardless of the type for arg), `:enforce_strict_literals` (raises
         | 
| 306 311 | 
             
            an exception if the arg is a Fixnum or Symbol), `:enforce_strict_ids` (raises and exception if the arg is a Fixnum) and
         | 
| 307 312 | 
             
            `:enforce_strict_symbols` (raises an exception if the arg is a Symbol).
         | 
| 308 313 |  | 
| 309 314 | 
             
            The purpose of the `:on_lookup_failure` option is that a) under some circumstances a lookup failure is a Bad Thing and
         | 
| 310 | 
            -
            action should be taken, therefore b) a fallback action should be easily configurable. | 
| 315 | 
            +
            action should be taken, therefore b) a fallback action should be easily configurable. As of version 0.8.4, you can
         | 
| 311 316 | 
             
            also set `:on_lookup_failure` to a lambda that takes in a single argument (The arg that was passed to `[]`).
         | 
| 312 317 |  | 
| 313 | 
            -
            As of version 0.8.0, you can pass in multiple arguments to `[]`. | 
| 314 | 
            -
            passed in values. | 
| 318 | 
            +
            As of version 0.8.0, you can pass in multiple arguments to `[]`. This returns a list of enums corresponding to the
         | 
| 319 | 
            +
            passed in values. Duplicates are filtered out. For example `BookingStatus[arg1, arg2, arg3]` would be equivalent to
         | 
| 315 320 | 
             
            `[BookingStatus[arg1], BookingStatus[arg2], BookingStatus[arg3]]`.
         | 
| 316 321 |  | 
| 317 322 | 
             
            ##### contains?(arg) (since version 0.10.0)
         | 
| 318 323 |  | 
| 319 324 | 
             
            `BookingStatus.contains?(arg)` returns `true if` the given Symbol, String or id has a member instance in the enumeration,
         | 
| 320 | 
            -
            `false` otherwise. | 
| 325 | 
            +
            `false` otherwise. Returns `true` if the argument is an enum instance, returns `false` if the argument  is `nil` or any
         | 
| 321 326 | 
             
            other value.
         | 
| 322 327 |  | 
| 323 328 | 
             
            ##### all
         | 
| @@ -327,12 +332,12 @@ other value. | |
| 327 332 |  | 
| 328 333 | 
             
            ##### active
         | 
| 329 334 |  | 
| 330 | 
            -
            `BookingStatus.active` returns an array of all BookingStatus records that are marked active. | 
| 335 | 
            +
            `BookingStatus.active` returns an array of all BookingStatus records that are marked active. See the `active?` instance
         | 
| 331 336 | 
             
            method.
         | 
| 332 337 |  | 
| 333 338 | 
             
            ##### inactive
         | 
| 334 339 |  | 
| 335 | 
            -
            `BookingStatus.inactive` returns an array of all BookingStatus records that are inactive. | 
| 340 | 
            +
            `BookingStatus.inactive` returns an array of all BookingStatus records that are inactive. See the `inactive?` instance
         | 
| 336 341 | 
             
            method.
         | 
| 337 342 |  | 
| 338 343 | 
             
            ##### names (since version 0.6.3)
         | 
| @@ -341,7 +346,7 @@ method. | |
| 341 346 |  | 
| 342 347 | 
             
            ##### update\_enumerations\_model (since version 0.8.1)
         | 
| 343 348 |  | 
| 344 | 
            -
            The preferred mechanism to update an enumerations model in migrations and similar. | 
| 349 | 
            +
            The preferred mechanism to update an enumerations model in migrations and similar. Pass in a block to this method to
         | 
| 345 350 | 
             
            to perform any updates.
         | 
| 346 351 |  | 
| 347 352 | 
             
            Example:
         | 
| @@ -366,7 +371,7 @@ end | |
| 366 371 |  | 
| 367 372 | 
             
            ##### acts\_as\_enumerated? (since version 0.8.6)
         | 
| 368 373 |  | 
| 369 | 
            -
            Returns `true` for ActiveRecord models that act as enumerated, `false` for others. | 
| 374 | 
            +
            Returns `true` for ActiveRecord models that act as enumerated, `false` for others. So
         | 
| 370 375 | 
             
            `BookingStatus.acts_as_enumerated?` would return `true`, while `Booking.acts_as_enumerated?` would return `false`.
         | 
| 371 376 |  | 
| 372 377 | 
             
            #### Instance Methods
         | 
| @@ -415,12 +420,12 @@ Returns the string representation of the enum, i.e. the value in the `:name_colu | |
| 415 420 |  | 
| 416 421 | 
             
            ##### name
         | 
| 417 422 |  | 
| 418 | 
            -
            By default, aliased to the string representation of the `:name_column` attribute. | 
| 423 | 
            +
            By default, aliased to the string representation of the `:name_column` attribute. To avoid this, set the `alias_name`
         | 
| 419 424 | 
             
            option to `false`.
         | 
| 420 425 |  | 
| 421 426 | 
             
            ##### name\_sym
         | 
| 422 427 |  | 
| 423 | 
            -
            Returns the symbol representation of the name of the enum. | 
| 428 | 
            +
            Returns the symbol representation of the name of the enum. `BookingStatus[:foo].name_sym` returns :foo.
         | 
| 424 429 |  | 
| 425 430 | 
             
            ##### to\_sym
         | 
| 426 431 |  | 
| @@ -428,20 +433,20 @@ Aliased to `name_sym` (Since version 0.9.0). | |
| 428 433 |  | 
| 429 434 | 
             
            ##### active?
         | 
| 430 435 |  | 
| 431 | 
            -
            Returns true if the instance is active, false otherwise. | 
| 432 | 
            -
            returns the attribute cast to a boolean, otherwise returns true. | 
| 436 | 
            +
            Returns true if the instance is active, false otherwise. If it has an attribute 'active',
         | 
| 437 | 
            +
            returns the attribute cast to a boolean, otherwise returns true. This method is used by the `active`
         | 
| 433 438 | 
             
            class method to select active enums.
         | 
| 434 439 |  | 
| 435 440 | 
             
            ##### inactive?
         | 
| 436 441 |  | 
| 437 | 
            -
            Returns true if the instance is inactive, false otherwise. | 
| 442 | 
            +
            Returns true if the instance is inactive, false otherwise. Default implementations returns `!active?`
         | 
| 438 443 | 
             
            This method is used by the `inactive` class method to select inactive enums.
         | 
| 439 444 |  | 
| 440 445 | 
             
            #### Notes
         | 
| 441 446 |  | 
| 442 447 | 
             
            `acts_as_enumerated` records are considered immutable. By default you cannot create/alter/destroy instances because they
         | 
| 443 | 
            -
            are cached in memory. | 
| 444 | 
            -
            records as the caches will get out of sync. | 
| 448 | 
            +
            are cached in memory. Because of Rails' process-based model it is not safe to allow updating acts\_as\_enumerated
         | 
| 449 | 
            +
            records as the caches will get out of sync. Also, as of version 0.5.1, `to_s` is overriden to return the name of the
         | 
| 445 450 | 
             
            enum instance.
         | 
| 446 451 |  | 
| 447 452 | 
             
            However, one instance where updating the models *should* be allowed is if you are using seeds.rb to seed initial values
         | 
| @@ -461,7 +466,7 @@ Note that a `:presence` and `:uniqueness` validation is automatically defined on | |
| 461 466 | 
             
            ### has\_enumerated
         | 
| 462 467 |  | 
| 463 468 | 
             
            First of all, note that you *could* specify the relationship to an `acts_as_enumerated` class using the `belongs_to`
         | 
| 464 | 
            -
            association. | 
| 469 | 
            +
            association. However, `has_enumerated` is preferable because you aren't really associated to the enumerated value, you
         | 
| 465 470 | 
             
            are *aggregating* it. As such, the `has_enumerated` macro behaves more like an aggregation than an association.
         | 
| 466 471 |  | 
| 467 472 | 
             
            ```ruby
         | 
| @@ -470,19 +475,19 @@ class Booking < ActiveRecord::Base | |
| 470 475 | 
             
                              :class_name        => 'BookingStatus',
         | 
| 471 476 | 
             
                              :foreign_key       => 'status_id',
         | 
| 472 477 | 
             
                              :on_lookup_failure => :optional_instance_method,
         | 
| 473 | 
            -
                              :permit_empty_name => true,  #Setting this to true disables automatic conversion of empty strings to nil. | 
| 478 | 
            +
                              :permit_empty_name => true,  #Setting this to true disables automatic conversion of empty strings to nil. Default is false.
         | 
| 474 479 | 
             
                              :default           => :unconfirmed,  #Default value of the attribute.
         | 
| 475 480 | 
             
                              :create_scope      => false  #Setting this to false disables the automatic creation of the 'with_status' scope.
         | 
| 476 481 | 
             
            end
         | 
| 477 482 | 
             
            ```
         | 
| 478 483 |  | 
| 479 484 | 
             
            By default, the foreign key is interpreted to be the name of your has\_enumerated field (in this case 'booking\_status')
         | 
| 480 | 
            -
            plus '\_id'. | 
| 481 | 
            -
            it. | 
| 482 | 
            -
            field. `:on_lookup_failure` is explained below. | 
| 483 | 
            -
            conversion of empty strings to nil. | 
| 485 | 
            +
            plus '\_id'. Since we chose to make the column name 'status\_id' for the sake of brevity, we must explicitly designate
         | 
| 486 | 
            +
            it. Additionally, the default value for `:class_name` is the camelized version of the name for your has\_enumerated
         | 
| 487 | 
            +
            field. `:on_lookup_failure` is explained below. `:permit_empty_name` is an optional flag to disable automatic
         | 
| 488 | 
            +
            conversion of empty strings to nil. It is typically desirable to have `booking.update_attributes(:status => '')`
         | 
| 484 489 | 
             
            assign status\_id to a nil rather than raise an Error, as you'll be often calling `update_attributes` with form data, but
         | 
| 485 | 
            -
            the choice is yours. | 
| 490 | 
            +
            the choice is yours. Setting a `:default` option will generate an after\_initialize callback to set a default value on
         | 
| 486 491 | 
             
            the attribute unless a non-nil value has already been set.
         | 
| 487 492 |  | 
| 488 493 | 
             
            With that, your Booking class will have the following methods defined:
         | 
| @@ -493,7 +498,7 @@ Returns the BookingStatus with an id that matches the value in the Booking.statu | |
| 493 498 |  | 
| 494 499 | 
             
            #### status=(arg)
         | 
| 495 500 |  | 
| 496 | 
            -
            Sets the value for Booking.status\_id using the id of the BookingStatus instance passed as an argument. | 
| 501 | 
            +
            Sets the value for Booking.status\_id using the id of the BookingStatus instance passed as an argument. As a
         | 
| 497 502 | 
             
            short-hand, you can also pass it the 'name' of a BookingStatus instance, either as a 'string' or :symbol, or pass in the
         | 
| 498 503 | 
             
            id directly.
         | 
| 499 504 |  | 
| @@ -516,12 +521,12 @@ mybooking.status = BookingStatus[:confirmed] | |
| 516 521 | 
             
            ```
         | 
| 517 522 |  | 
| 518 523 | 
             
            The `:on_lookup_failure` option in has\_enumerated is there because you may want to create an error handler for
         | 
| 519 | 
            -
            situations where the argument passed to `status=(arg)` is invalid. | 
| 524 | 
            +
            situations where the argument passed to `status=(arg)` is invalid. By default, an invalid value will cause an
         | 
| 520 525 | 
             
            ArgumentError to be raised.
         | 
| 521 526 |  | 
| 522 | 
            -
            Of course, this may not be optimal in your situation. | 
| 527 | 
            +
            Of course, this may not be optimal in your situation. In this case you can do one of three things:
         | 
| 523 528 |  | 
| 524 | 
            -
            1) You can set it to 'validation\_error'. | 
| 529 | 
            +
            1) You can set it to 'validation\_error'. In this case, the invalid value will be cached and returned on
         | 
| 525 530 | 
             
            subsequent lookups, but the model will fail validation.
         | 
| 526 531 |  | 
| 527 532 | 
             
            2) Specify an *instance* method to be called in the case of a lookup failure. The method signature is as follows:
         | 
| @@ -530,13 +535,13 @@ subsequent lookups, but the model will fail validation. | |
| 530 535 | 
             
            your_lookup_handler(operation, name, name_foreign_key, acts_enumerated_class_name, lookup_value)
         | 
| 531 536 | 
             
            ```
         | 
| 532 537 |  | 
| 533 | 
            -
            The 'operation' arg will be either `:read` or `:write`. | 
| 538 | 
            +
            The 'operation' arg will be either `:read` or `:write`. In the case of `:read` you are expected to return something or
         | 
| 534 539 | 
             
            raise an exception, while in the case of a `:write` you don't have to return anything.
         | 
| 535 540 |  | 
| 536 541 | 
             
            Note that there's enough information in the method signature that you can specify one method to handle all lookup
         | 
| 537 542 | 
             
            failures for all has\_enumerated fields if you happen to have more than one defined in your model.
         | 
| 538 543 |  | 
| 539 | 
            -
            3) (Since version 0.8.5) Give it a lambda function. | 
| 544 | 
            +
            3) (Since version 0.8.5) Give it a lambda function. In that case, the lambda needs to accept the ActiveRecord model as
         | 
| 540 545 | 
             
            its first argument, with the rest of the arguments being identical to the signature of the lookup handler instance
         | 
| 541 546 | 
             
            method.
         | 
| 542 547 |  | 
| @@ -547,18 +552,18 @@ method. | |
| 547 552 | 
             
            ```
         | 
| 548 553 |  | 
| 549 554 | 
             
            NOTE: A `nil` is always considered to be a valid value for `status=(arg)` since it's assumed you're trying to null out
         | 
| 550 | 
            -
            the foreign key. | 
| 555 | 
            +
            the foreign key. The `:on_lookup_failure` will be bypassed.
         | 
| 551 556 |  | 
| 552 557 | 
             
            #### with\_enumerated\_attribute scope
         | 
| 553 558 |  | 
| 554 559 | 
             
            Unless the `:create_scope` option is set to `false`, a scope is automatically created that takes a list of enums as
         | 
| 555 | 
            -
            arguments. | 
| 560 | 
            +
            arguments. This allows us to say things like:
         | 
| 556 561 |  | 
| 557 562 | 
             
            ```ruby
         | 
| 558 563 | 
             
            Booking.with_status :confirmed, :received
         | 
| 559 564 | 
             
            ```
         | 
| 560 565 |  | 
| 561 | 
            -
            Strings, symbols, ids, or enum instances are all valid arguments. | 
| 566 | 
            +
            Strings, symbols, ids, or enum instances are all valid arguments. For example, the following would be valid, though not
         | 
| 562 567 | 
             
            recommended for obvious reasons.
         | 
| 563 568 |  | 
| 564 569 | 
             
            ```ruby
         | 
| @@ -570,7 +575,7 @@ As of version 0.5.5, it also aliases a pluralized version of the scope, i.e. `:w | |
| 570 575 | 
             
            #### exclude\_enumerated\_attribute scope
         | 
| 571 576 |  | 
| 572 577 | 
             
            As of version 0.8.0, a scope for the inverse of `with_enumerated_attribute` is created, unless the `:create_scope`
         | 
| 573 | 
            -
            option is set to `false`. | 
| 578 | 
            +
            option is set to `false`. As a result, this allows us to do things like
         | 
| 574 579 |  | 
| 575 580 | 
             
            ```ruby
         | 
| 576 581 | 
             
            Booking.exclude_status :received
         | 
| @@ -588,7 +593,7 @@ The following methods are added to ActiveRecord::Base as class methods. | |
| 588 593 |  | 
| 589 594 | 
             
            #### has\_enumerated?(attr)
         | 
| 590 595 |  | 
| 591 | 
            -
            Returns true if the given attr is an enumerated attributes, false otherwise. | 
| 596 | 
            +
            Returns true if the given attr is an enumerated attributes, false otherwise. `attr` can be a string or a symbol. This
         | 
| 592 597 | 
             
            is a class method.
         | 
| 593 598 |  | 
| 594 599 | 
             
            #### enumerated\_attributes
         | 
| @@ -597,7 +602,7 @@ Returns an array of attributes which are enumerated. | |
| 597 602 |  | 
| 598 603 | 
             
            ### ActiveRecord::VirtualEnumerations
         | 
| 599 604 |  | 
| 600 | 
            -
            In many instances, your `acts_as_enumerated` classes will do nothing more than just act as enumerated. | 
| 605 | 
            +
            In many instances, your `acts_as_enumerated` classes will do nothing more than just act as enumerated. In that case,
         | 
| 601 606 | 
             
            you can use ActiveRecord::VirtualEnumerations to reduce that clutter.
         | 
| 602 607 |  | 
| 603 608 | 
             
            Create a custom Rails initializer: Rails.root/config/initializers/virtual\_enumerations.rb
         | 
| @@ -632,9 +637,9 @@ ActiveRecord::VirtualEnumerations.define do |config| | |
| 632 637 | 
             
            end
         | 
| 633 638 | 
             
            ```
         | 
| 634 639 |  | 
| 635 | 
            -
            Only the 'ClassName' argument is required. | 
| 636 | 
            -
            option is used to set a custom superclass. | 
| 637 | 
            -
            underscores, like class\_name. | 
| 640 | 
            +
            Only the 'ClassName' argument is required. `:table_name` is used to define a custom table name while the `:extends`
         | 
| 641 | 
            +
            option is used to set a custom superclass. Class names can be either camel-cased like ClassName or with
         | 
| 642 | 
            +
            underscores, like class\_name. Strings and symbols are both fine.
         | 
| 638 643 |  | 
| 639 644 | 
             
            If you need to fine-tune the definition of the enum class, you can optionally pass in a block, which will be
         | 
| 640 645 | 
             
            evaluated in the context of the enum class.
         | 
| @@ -679,7 +684,7 @@ A pair of custom RSpec matchers are included to streamline testing of enums and | |
| 679 684 |  | 
| 680 685 | 
             
            #### act\_as\_enumerated
         | 
| 681 686 |  | 
| 682 | 
            -
            This is used to test that a model acts as enumerated. | 
| 687 | 
            +
            This is used to test that a model acts as enumerated. Example:
         | 
| 683 688 |  | 
| 684 689 | 
             
            ```ruby
         | 
| 685 690 | 
             
            describe BookingStatus do
         | 
| @@ -707,7 +712,7 @@ describe BookingStatus do | |
| 707 712 | 
             
            end
         | 
| 708 713 | 
             
            ```
         | 
| 709 714 |  | 
| 710 | 
            -
            You can also pass in hashes if you want to be thorough and test out all the attributes of each enum. | 
| 715 | 
            +
            You can also pass in hashes if you want to be thorough and test out all the attributes of each enum. If
         | 
| 711 716 | 
             
            you do this, you must pass in the `:name` attribute in each hash
         | 
| 712 717 |  | 
| 713 718 | 
             
            ```ruby
         | 
| @@ -795,12 +800,12 @@ Go back to gem root directory: | |
| 795 800 | 
             
            * Initial Test Suite Copyright (c) 2011 Sergey Potapov
         | 
| 796 801 | 
             
            * Subsequent Updates Copyright (c) 2011-2013 Arthur Shagall
         | 
| 797 802 |  | 
| 798 | 
            -
            Released under the MIT License. | 
| 803 | 
            +
            Released under the MIT License. See the LICENSE file for more details.
         | 
| 799 804 |  | 
| 800 805 | 
             
            ## Contributing
         | 
| 801 806 |  | 
| 802 | 
            -
            Contributions are welcome. | 
| 807 | 
            +
            Contributions are welcome. However, please make sure of the following before issuing a pull request:
         | 
| 803 808 |  | 
| 804 809 | 
             
            * All specs are passing.
         | 
| 805 | 
            -
            * Any new features have test coverage. | 
| 810 | 
            +
            * Any new features have test coverage. Use the SimpleCov report to confirm.
         | 
| 806 811 | 
             
            * Anything that breaks backward compatibility has a very good reason for doing so.
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,8 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: power_enum
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.3. | 
| 4 | 
            +
              version: 1.3.4
         | 
| 5 | 
            +
              prerelease: 
         | 
| 5 6 | 
             
            platform: ruby
         | 
| 6 7 | 
             
            authors:
         | 
| 7 8 | 
             
            - Trevor Squires
         | 
| @@ -39,11 +40,12 @@ cert_chain: | |
| 39 40 | 
             
              amZaYUtWM2wwYTFkR2wyUVNMa2pScFFaRDFiRCtVSDdnT3F5N1piZGNzUkJM
         | 
| 40 41 | 
             
              NEg3VTV6VQpibEtkZEg2dXhDckRTTTdLYWJrelNPVmYKLS0tLS1FTkQgQ0VS
         | 
| 41 42 | 
             
              VElGSUNBVEUtLS0tLQo=
         | 
| 42 | 
            -
            date: 2013- | 
| 43 | 
            +
            date: 2013-08-20 00:00:00.000000000 Z
         | 
| 43 44 | 
             
            dependencies:
         | 
| 44 45 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 45 46 | 
             
              name: rails
         | 
| 46 47 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 48 | 
            +
                none: false
         | 
| 47 49 | 
             
                requirements:
         | 
| 48 50 | 
             
                - - ~>
         | 
| 49 51 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -51,6 +53,7 @@ dependencies: | |
| 51 53 | 
             
              type: :runtime
         | 
| 52 54 | 
             
              prerelease: false
         | 
| 53 55 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 56 | 
            +
                none: false
         | 
| 54 57 | 
             
                requirements:
         | 
| 55 58 | 
             
                - - ~>
         | 
| 56 59 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -58,6 +61,7 @@ dependencies: | |
| 58 61 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 59 62 | 
             
              name: jeweler
         | 
| 60 63 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 64 | 
            +
                none: false
         | 
| 61 65 | 
             
                requirements:
         | 
| 62 66 | 
             
                - - ! '>='
         | 
| 63 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -65,6 +69,7 @@ dependencies: | |
| 65 69 | 
             
              type: :development
         | 
| 66 70 | 
             
              prerelease: false
         | 
| 67 71 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                none: false
         | 
| 68 73 | 
             
                requirements:
         | 
| 69 74 | 
             
                - - ! '>='
         | 
| 70 75 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -72,6 +77,7 @@ dependencies: | |
| 72 77 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 73 78 | 
             
              name: yard
         | 
| 74 79 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 80 | 
            +
                none: false
         | 
| 75 81 | 
             
                requirements:
         | 
| 76 82 | 
             
                - - ! '>='
         | 
| 77 83 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -79,6 +85,7 @@ dependencies: | |
| 79 85 | 
             
              type: :development
         | 
| 80 86 | 
             
              prerelease: false
         | 
| 81 87 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 88 | 
            +
                none: false
         | 
| 82 89 | 
             
                requirements:
         | 
| 83 90 | 
             
                - - ! '>='
         | 
| 84 91 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -86,6 +93,7 @@ dependencies: | |
| 86 93 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 87 94 | 
             
              name: rspec
         | 
| 88 95 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 96 | 
            +
                none: false
         | 
| 89 97 | 
             
                requirements:
         | 
| 90 98 | 
             
                - - ! '>='
         | 
| 91 99 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -93,6 +101,7 @@ dependencies: | |
| 93 101 | 
             
              type: :development
         | 
| 94 102 | 
             
              prerelease: false
         | 
| 95 103 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 104 | 
            +
                none: false
         | 
| 96 105 | 
             
                requirements:
         | 
| 97 106 | 
             
                - - ! '>='
         | 
| 98 107 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -100,6 +109,7 @@ dependencies: | |
| 100 109 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 101 110 | 
             
              name: sqlite3
         | 
| 102 111 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 112 | 
            +
                none: false
         | 
| 103 113 | 
             
                requirements:
         | 
| 104 114 | 
             
                - - ! '>='
         | 
| 105 115 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -107,6 +117,7 @@ dependencies: | |
| 107 117 | 
             
              type: :development
         | 
| 108 118 | 
             
              prerelease: false
         | 
| 109 119 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 120 | 
            +
                none: false
         | 
| 110 121 | 
             
                requirements:
         | 
| 111 122 | 
             
                - - ! '>='
         | 
| 112 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -114,6 +125,7 @@ dependencies: | |
| 114 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 115 126 | 
             
              name: genspec
         | 
| 116 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                none: false
         | 
| 117 129 | 
             
                requirements:
         | 
| 118 130 | 
             
                - - ! '>='
         | 
| 119 131 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -121,6 +133,7 @@ dependencies: | |
| 121 133 | 
             
              type: :development
         | 
| 122 134 | 
             
              prerelease: false
         | 
| 123 135 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 136 | 
            +
                none: false
         | 
| 124 137 | 
             
                requirements:
         | 
| 125 138 | 
             
                - - ! '>='
         | 
| 126 139 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -163,27 +176,29 @@ files: | |
| 163 176 | 
             
            - LICENSE
         | 
| 164 177 | 
             
            - README.markdown
         | 
| 165 178 | 
             
            homepage: http://github.com/albertosaurus/power_enum
         | 
| 166 | 
            -
            licenses: | 
| 167 | 
            -
             | 
| 179 | 
            +
            licenses:
         | 
| 180 | 
            +
            - MIT
         | 
| 168 181 | 
             
            post_install_message: 
         | 
| 169 182 | 
             
            rdoc_options: []
         | 
| 170 183 | 
             
            require_paths:
         | 
| 171 184 | 
             
            - lib
         | 
| 172 185 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 186 | 
            +
              none: false
         | 
| 173 187 | 
             
              requirements:
         | 
| 174 188 | 
             
              - - ! '>='
         | 
| 175 189 | 
             
                - !ruby/object:Gem::Version
         | 
| 176 190 | 
             
                  version: '0'
         | 
| 177 191 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 192 | 
            +
              none: false
         | 
| 178 193 | 
             
              requirements:
         | 
| 179 194 | 
             
              - - ! '>='
         | 
| 180 195 | 
             
                - !ruby/object:Gem::Version
         | 
| 181 196 | 
             
                  version: '0'
         | 
| 182 197 | 
             
            requirements: []
         | 
| 183 198 | 
             
            rubyforge_project: 
         | 
| 184 | 
            -
            rubygems_version:  | 
| 199 | 
            +
            rubygems_version: 1.8.25
         | 
| 185 200 | 
             
            signing_key: 
         | 
| 186 | 
            -
            specification_version:  | 
| 201 | 
            +
            specification_version: 3
         | 
| 187 202 | 
             
            summary: Allows you to treat instances of your ActiveRecord models as though they
         | 
| 188 203 | 
             
              were an enumeration of values
         | 
| 189 204 | 
             
            test_files: []
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file | 
    
        checksums.yaml
    DELETED
    
    | @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            ---
         | 
| 2 | 
            -
            !binary "U0hBMQ==":
         | 
| 3 | 
            -
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                YTUwNmE0YTk3MTlmNTg1ZWU0ZTYwZjQ4NWZkODRlMDM2YTNmNWNhZg==
         | 
| 5 | 
            -
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                ODQzZjYyZGI3ZTFkNmMzZjM4ZTEwZjAzOWFhNjdlNDE2ZTgwNjA2OA==
         | 
| 7 | 
            -
            !binary "U0hBNTEy":
         | 
| 8 | 
            -
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                YjBmNDRhYTIwZjM3ZTY2OGRkOGE5YzA0NTEwZmQwZDZhYmZjNGUxZjRjZDA5
         | 
| 10 | 
            -
                OGI1YzgyZmRjZjY3NDJhMmNhMzVkZTlmMjBlMDFlMmI2ZjdiY2ZhZTdjM2M4
         | 
| 11 | 
            -
                MjU3NTJmOTgyZTBjZjQxYTFiNTY3YWU1MGZiYTYyMDBhNGQ1ZmU=
         | 
| 12 | 
            -
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                MTc3NWQ1ZWNlNzY5YTE2ZjA1Y2Y4NTBhMzNiMTY3YjkyMTA1ZmFhYjFmZDJk
         | 
| 14 | 
            -
                NjM4NzVmNzQ4ZGVhYjJkMjZlNTRhNDAxYjU0NGM1OGVjZDg1NGMxM2RlOWNl
         | 
| 15 | 
            -
                NjNjYTk4ZWZjZDMyZDEwM2JkMWUxMGJjMTQ5YzhjMWE1OWYzMWM=
         | 
    
        checksums.yaml.gz.sig
    DELETED
    
    | Binary file |