power_enum 2.0.0.rc → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2Q1NDg3Yzc2MDU2NjZmM2VlNDUwZWVhNTMxMTAyMzA5M2M0MDgwOQ==
4
+ YjczOWI2OTAxNmMxMmVmY2Q1ZjI5ZjAyZTFhMmUyNjllNDc2NzVlMw==
5
5
  data.tar.gz: !binary |-
6
- NDlkMWUzNTlkNDM1NWQ5YmEyNzk3Y2M0NzY3MzM5NWNlNWJiYjMzOA==
6
+ ZjNlM2IxMjNlZjBmZGE0YjZlMTA3ZDZjZWM3NzYzNjdlMTY5MGFkMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzkzZTAyNGIwNGExMWIzMzhhNzBlNWYzNmZlMWYwMzA3MzQyN2ZmYmVlNTA1
10
- MWNkZjNiYjYxYzk3NzMyNjkxMDQyNDM1ZDU0ZjEwMTliNjhiNjhhZDlmNzdj
11
- ZTQ4YmQ2NTI0NThlYTZiMDQyODY3ZTQ1NTFiNzg0ZjBjODk5ZDE=
9
+ OWJiOWExODIxNWU4MDVmYTA3NTRiMmE0NjlmMTRiMGNlMmE3Y2QzMWNhMTFj
10
+ OGM1N2RkNWMxNzdlMDY5M2ExOGFjYzJhNzkzMDMxMGU3ODUyODNmYTJhZjkz
11
+ MTdiNDZlZWE1YjQ5NmFiOTNlZWYwZWJlZjg0NTNlY2ViNzNhNzc=
12
12
  data.tar.gz: !binary |-
13
- ZTM4OWI0NWQ5MjBmYThkYTlmZjVkYzVkM2JkMjE2MWRjNjY0NzRmNzM5ODdk
14
- MTEzMmU4NGQzOTM4MjNhNDJmNGE1NTIwNTdiZWY1NTc5YTFhYWQ1YWFiNTgy
15
- YzUwODNmZTM4MmQ3ODQ2NzU0Mzg3YjI2NDNjM2M4NTRmYzA5MDQ=
13
+ NGE0MGYzM2RmMTQyNTU1OTBkZjlhOGFjMDRjZTczYjQ1ZGJlY2QxMWUzOGY1
14
+ NTNmNjViMzk4YmFlZDMxNDFkYjZmODAxNWM2ZTUzNzlmYmUwNDA4YjQyOWY0
15
+ YmNmZWEwMzM0ZDhhNzI3YjFiNzM2M2QxNWE3NmY0MTlmZWRiNGM=
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  Initial Version Copyright (c) 2005 Trevor Squires
2
2
  Rails 3 Updates Copyright (c) 2010 Pivotal Labs
3
3
  Initial Test Suite Copyright (c) 2011 Sergey Potapov
4
- Subsequent Updates Copyright (c) 2011 Arthur Shagall
4
+ Subsequent Updates Copyright (c) 2011-2013 Arthur Shagall
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining
7
7
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -290,8 +290,7 @@ class BookingStatus < ActiveRecord::Base
290
290
  :on_lookup_failure => :optional_class_method, #This also works: lambda{ |arg| some_custom_action }
291
291
  :name_column => 'optional_name_column' #If required, may override the default name column
292
292
  :alias_name => false #If set to false and have name_column set, will not
293
- # alias :name to the name column attribute
294
- # (version 0.9.0).
293
+ # alias :name to the name column attribute.
295
294
  end
296
295
  ```
297
296
 
@@ -303,8 +302,8 @@ With that, your BookingStatus class will have the following methods defined:
303
302
 
304
303
  `BookingStatus[arg]` performs a lookup for the BookingStatus instance for the given arg. The arg value can be a
305
304
  'string' or a :symbol, in which case the lookup will be against the BookingStatus.name field. Alternatively arg can be
306
- a Fixnum, in which case the lookup will be against the BookingStatus.id field. Since version 0.5.3, it returns the arg
307
- if arg is an instance of the enum (in this case BookingStatus) as a convenience.
305
+ a Fixnum, in which case the lookup will be against the BookingStatus.id field. It returns the arg if arg is an
306
+ instance of the enum (in this case BookingStatus) as a convenience.
308
307
 
309
308
  The `:on_lookup_failure` option specifies the name of a *class* method to invoke when the `[]` method is unable to
310
309
  locate a BookingStatus record for arg. The default is the built-in `:enforce_none` which returns nil. There are also
@@ -313,14 +312,14 @@ an exception if the arg is a Fixnum or Symbol), `:enforce_strict_ids` (raises an
313
312
  `:enforce_strict_symbols` (raises an exception if the arg is a Symbol).
314
313
 
315
314
  The purpose of the `:on_lookup_failure` option is that a) under some circumstances a lookup failure is a Bad Thing and
316
- action should be taken, therefore b) a fallback action should be easily configurable. As of version 0.8.4, you can
315
+ action should be taken, therefore b) a fallback action should be easily configurable. You can
317
316
  also set `:on_lookup_failure` to a lambda that takes in a single argument (The arg that was passed to `[]`).
318
317
 
319
- As of version 0.8.0, you can pass in multiple arguments to `[]`. This returns a list of enums corresponding to the
318
+ You can also pass in multiple arguments to `[]`. This returns a list of enums corresponding to the
320
319
  passed in values. Duplicates are filtered out. For example `BookingStatus[arg1, arg2, arg3]` would be equivalent to
321
320
  `[BookingStatus[arg1], BookingStatus[arg2], BookingStatus[arg3]]`.
322
321
 
323
- ##### contains?(arg) (since version 0.10.0)
322
+ ##### contains?(arg)
324
323
 
325
324
  `BookingStatus.contains?(arg)` returns `true if` the given Symbol, String or id has a member instance in the enumeration,
326
325
  `false` otherwise. Returns `true` if the argument is an enum instance, returns `false` if the argument is `nil` or any
@@ -341,11 +340,11 @@ method.
341
340
  `BookingStatus.inactive` returns an array of all BookingStatus records that are inactive. See the `inactive?` instance
342
341
  method.
343
342
 
344
- ##### names (since version 0.6.3)
343
+ ##### names
345
344
 
346
345
  `BookingStatus.names` will return all the names of the defined enums as an array of symbols.
347
346
 
348
- ##### update\_enumerations\_model (since version 0.8.1)
347
+ ##### update\_enumerations\_model
349
348
 
350
349
  The preferred mechanism to update an enumerations model in migrations and similar. Pass in a block to this method to
351
350
  to perform any updates.
@@ -360,7 +359,7 @@ BookingStatus.update_enumerations_model do
360
359
  end
361
360
  ```
362
361
 
363
- Example 2 (since version 0.9.3):
362
+ Example 2:
364
363
 
365
364
  ```ruby
366
365
  BookingStatus.update_enumerations_model do |klass|
@@ -370,7 +369,7 @@ BookingStatus.update_enumerations_model do |klass|
370
369
  end
371
370
  ```
372
371
 
373
- ##### acts\_as\_enumerated? (since version 0.8.6)
372
+ ##### acts\_as\_enumerated?
374
373
 
375
374
  Returns `true` for ActiveRecord models that act as enumerated, `false` for others. So
376
375
  `BookingStatus.acts_as_enumerated?` would return `true`, while `Booking.acts_as_enumerated?` would return `false`.
@@ -430,7 +429,7 @@ Returns the symbol representation of the name of the enum. `BookingStatus[:foo].
430
429
 
431
430
  ##### to\_sym
432
431
 
433
- Aliased to `name_sym` (Since version 0.9.0).
432
+ Aliased to `name_sym`.
434
433
 
435
434
  ##### active?
436
435
 
@@ -447,8 +446,7 @@ This method is used by the `inactive` class method to select inactive enums.
447
446
 
448
447
  `acts_as_enumerated` records are considered immutable. By default you cannot create/alter/destroy instances because they
449
448
  are cached in memory. Because of Rails' process-based model it is not safe to allow updating acts\_as\_enumerated
450
- 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
451
- enum instance.
449
+ records as the caches will get out of sync. Also, `to_s` is overriden to return the name of the enum instance.
452
450
 
453
451
  However, one instance where updating the models *should* be allowed is if you are using seeds.rb to seed initial values
454
452
  into the database.
@@ -542,7 +540,7 @@ raise an exception, while in the case of a `:write` you don't have to return any
542
540
  Note that there's enough information in the method signature that you can specify one method to handle all lookup
543
541
  failures for all has\_enumerated fields if you happen to have more than one defined in your model.
544
542
 
545
- 3) (Since version 0.8.5) Give it a lambda function. In that case, the lambda needs to accept the ActiveRecord model as
543
+ 3) Give it a lambda function. In that case, the lambda needs to accept the ActiveRecord model as
546
544
  its first argument, with the rest of the arguments being identical to the signature of the lookup handler instance
547
545
  method.
548
546
 
@@ -571,11 +569,11 @@ recommended for obvious reasons.
571
569
  Booking.with_status 1, 'confirmed', BookingStatus[:rejected]
572
570
  ```
573
571
 
574
- As of version 0.5.5, it also aliases a pluralized version of the scope, i.e. `:with_statuses`
572
+ As a convenience, it also aliases a pluralized version of the scope, i.e. `:with_statuses`
575
573
 
576
574
  #### exclude\_enumerated\_attribute scope
577
575
 
578
- As of version 0.8.0, a scope for the inverse of `with_enumerated_attribute` is created, unless the `:create_scope`
576
+ By default, a scope for the inverse of `with_enumerated_attribute` is created, unless the `:create_scope`
579
577
  option is set to `false`. As a result, this allows us to do things like
580
578
 
581
579
  ```ruby
@@ -608,7 +606,7 @@ you can use ActiveRecord::VirtualEnumerations to reduce that clutter.
608
606
 
609
607
  Create a custom Rails initializer: Rails.root/config/initializers/virtual\_enumerations.rb
610
608
 
611
- NOTE: As of version 0.9.2, there is a built in generator for this:
609
+ To streamline this, a generator is provided:
612
610
 
613
611
  ```bash
614
612
  rails generate virtual_enumerations_initializer
@@ -679,7 +677,7 @@ config.define :base_enum, :name_column => ;foo
679
677
  config.define :booking_status, :connector_type, :color, :extends => :base_enum
680
678
  ```
681
679
 
682
- ### Testing (Since version 0.6.0)
680
+ ### Testing
683
681
 
684
682
  A pair of custom RSpec matchers are included to streamline testing of enums and enumerated attributes.
685
683
 
@@ -748,7 +746,7 @@ describe Booking do
748
746
  end
749
747
  ```
750
748
 
751
- #### match\_enum (Since version 0.8.6)
749
+ #### match\_enum
752
750
 
753
751
  Tests if an enum instance matches the given value, which may be a symbol, id, string, or enum instance:
754
752
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Squires
@@ -39,7 +39,7 @@ cert_chain:
39
39
  amZaYUtWM2wwYTFkR2wyUVNMa2pScFFaRDFiRCtVSDdnT3F5N1piZGNzUkJM
40
40
  NEg3VTV6VQpibEtkZEg2dXhDckRTTTdLYWJrelNPVmYKLS0tLS1FTkQgQ0VS
41
41
  VElGSUNBVEUtLS0tLQo=
42
- date: 2013-06-30 00:00:00.000000000 Z
42
+ date: 2013-07-04 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: rails
@@ -162,7 +162,7 @@ files:
162
162
  - lib/testing/rspec.rb
163
163
  - LICENSE
164
164
  - README.markdown
165
- homepage: http://github.com/albertosaurus/power_enum
165
+ homepage: http://github.com/albertosaurus/power_enum_2
166
166
  licenses: []
167
167
  metadata: {}
168
168
  post_install_message:
@@ -176,9 +176,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
176
  version: '0'
177
177
  required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - ! '>'
179
+ - - ! '>='
180
180
  - !ruby/object:Gem::Version
181
- version: 1.3.1
181
+ version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
184
  rubygems_version: 2.0.3
metadata.gz.sig CHANGED
Binary file