power_enum 3.4.0 → 3.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e64bc976c66ec97d00cd14baabeb0fa7c13afc66500bb8408bc9d1e884be30ee
4
- data.tar.gz: 43f0a3fa296b90154d32b82a38d8ae207b0b8f400edc821ded353e341ddb5187
3
+ metadata.gz: afdfec8c704c968a3871c9444428cb385fcc3075bb56875a4018e4cf0f9ba5c0
4
+ data.tar.gz: 640c7bde6091cbe26b8263a000cb922c0df3c2c6e113c17d0c7846305873ee67
5
5
  SHA512:
6
- metadata.gz: b36b482f22cf0ddc61e817f77838a245a250a3c28771c0d0e39d8e23f29b782abd93fbb06c84fa6b009f66bdb510933b0e292a8ceeed60d190caeeeba24d05f2
7
- data.tar.gz: 2731947e3bb7d5f9b91fffd726db29ab26451536fc60b8110886d2d8ed3402af9f8f0d10471bea00c83f36e4577476df2fb1c2cdebe106b74d684e80d7637d33
6
+ metadata.gz: 2198b9d106a9428ae0ae1f70f1d15cc4c1874909d5870b5da43592878000791f2d0fe51e012fd6766a9bc00e4518c083430f68d1f894ece0e9a890c37a913fb4
7
+ data.tar.gz: 43e95cce4ffc0f4fe4e0fb4fe150d944fddea41bf89b530d2bcee20ff82b1bdea1783a3fc3db2580daa95086e7c51b53df650aae9ad90f83293792635b9dfd4c
data/README.markdown CHANGED
@@ -29,16 +29,17 @@ At it's most basic level, it allows you to say things along the lines of:
29
29
 
30
30
  ```ruby
31
31
  # Create a provisional booking
32
- booking = Booking.new( :status => BookingStatus[:provisional] )
32
+ booking = Booking.new( status: BookingStatus[:provisional] )
33
33
  # This also works
34
- booking = Booking.new( :status => :provisional )
34
+ booking = Booking.new( status: :provisional )
35
35
  # Set the booking status to 'confirmed'
36
36
  booking.status = :confirmed
37
- booking = Booking.create( :status => :rejected )
37
+ booking = Booking.create( status: :rejected )
38
38
  # And now...
39
39
  booking.status == BookingStatus[:rejected] # evaluates to true
40
40
  booking.status === :rejected # also evaluates to true
41
41
  booking.status === [:rejected, :confirmed, :provisional] # and so does this
42
+ booking.status === [%i[rejected confirmed provisional]] # and this
42
43
 
43
44
  Booking.where( :status_id => BookingStatus[:provisional] )
44
45
 
@@ -63,26 +64,7 @@ See "How to use it" below for more information.
63
64
 
64
65
  ## Installation
65
66
 
66
- ### READ THIS FIRST
67
-
68
- This gem is signed. The public key is available
69
- here: https://github.com/albertosaurus/power_enum (look for gem-public\_cert.pem). Hence, if
70
- you can get an error like the following if you're installing in `HighSecurity` mode.
71
-
72
- ```
73
- ERROR: While executing gem ... (RuntimeError)
74
- Couldn't verify data signature: Untrusted Signing Chain Root: cert = 'cert name', error = 'path "/your_gem_home/.gem/trust/cert-blah.pem" does not exist'
75
- ```
76
-
77
- If this happens, you need to add the PowerEnum public cert to your gem cert
78
- store. Download the certificate (gem-public\_cert.pem) and run the following.
79
-
80
- gem cert -a gem-public_cert.pem
81
-
82
- More information is available at http://guides.rubygems.org/security/
83
- which I strongly urge you to read.
84
-
85
- #### Using Bundler
67
+ ### Using Bundler
86
68
 
87
69
  Add the gem to your Gemfile
88
70
 
@@ -92,7 +74,7 @@ then run
92
74
 
93
75
  bundle install
94
76
 
95
- #### Manual Installation
77
+ ### Manual Installation
96
78
 
97
79
  gem install power_enum
98
80
 
@@ -298,10 +280,12 @@ drop_table :booking_statuses
298
280
  class BookingStatus < ActiveRecord::Base
299
281
  acts_as_enumerated :conditions => 'optional_sql_conditions',
300
282
  :order => 'optional_sql_order_by',
301
- :on_lookup_failure => :optional_class_method, #This also works: lambda{ |arg| some_custom_action }
302
- :name_column => 'optional_name_column' #If required, may override the default name column
303
- :alias_name => false #If set to false and have name_column set, will not
304
- # alias :name to the name column attribute.
283
+ :on_lookup_failure => :optional_class_method, # This also works: lambda{ |arg| some_custom_action }
284
+ :name_column => 'optional_name_column' # If required, may override the default name column
285
+ :alias_name => false, # If set to false and have name_column set, will not
286
+ # alias :name to the name column attribute.
287
+ :freeze_members => true # Optional, default is true in prod.
288
+ # This also works: lambda { true }
305
289
  end
306
290
  ```
307
291
 
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.7.0