power_enum 2.2.0 → 2.3.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 +8 -8
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.markdown +10 -7
- data/lib/power_enum/enumerated.rb +1 -1
- data/lib/power_enum/schema/schema_statements.rb +12 -8
- metadata +29 -26
- metadata.gz.sig +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDNhY2UwN2Q2ZjY4MGEwZDFmNmJlYTk5OTRiMTk3NjhjNjcwNmYzMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Zjc4Zjg0ZGNkMDVlYmM0MjBhZTllZmJhYmM0MjBiNmM3ZmFmMTM3Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGQxZTI0Mzg3ZTFhMjQ1M2RlZDY3MGU5YmFjNTgwMzY3Y2M3Mjc0NTJiZWNk
|
10
|
+
NmM0YjVmZGRjODZlYTZjOWYwMzYwYmJhOTY4NGI4NzQ3Y2IxYjY5OTNiY2Nj
|
11
|
+
Y2YyYWU4YzI4MTA2OWUyZDI4NmY3MmFiZGFhZmU5MmMwMmI3NDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDljNGEzYmQ1NWVmN2ZjMjVhMWUzZGM2NmJkYzYxNDM2ZWY1MmE5YmQxOTM5
|
14
|
+
YTJiZDQ5MzU1NjViMTA0YThkZTgxZmZiZGNiNWZlNjc4NDVmMjc1YzM0Nzcy
|
15
|
+
NTY1NzFiNDkyY2ViMDA4MDBlZTZlMmEzNTI5NDU5ZWQxYTI2Y2Q=
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.markdown
CHANGED
@@ -4,6 +4,7 @@ https://github.com/albertosaurus/power_enum_2
|
|
4
4
|
|
5
5
|
[](https://travis-ci.org/albertosaurus/power_enum_2)
|
6
6
|
[](https://codeclimate.com/github/albertosaurus/power_enum_2)
|
7
|
+
[](http://badge.fury.io/rb/power_enum)
|
7
8
|
|
8
9
|
Enumerations for Rails 4 Done Right.
|
9
10
|
|
@@ -203,6 +204,7 @@ Creates a new enum table. `enum_name` will be automatically pluralized. The foll
|
|
203
204
|
- [:desc\_limit] Set this to define the limit of the description column
|
204
205
|
- [: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.
|
205
206
|
- [:timestamps] Set this to `true` to have the timestamp columns (created\_at and updated\_at) generated
|
207
|
+
- [:table_options] Allows you to set a hash which will be passed directly to `create_table`.
|
206
208
|
|
207
209
|
You can also pass in a block that takes a table object as an argument, like `create_table`.
|
208
210
|
|
@@ -225,18 +227,19 @@ In a more complex case:
|
|
225
227
|
|
226
228
|
```ruby
|
227
229
|
create_enum :booking_status,
|
228
|
-
:name_column
|
229
|
-
:name_limit
|
230
|
-
:description
|
231
|
-
:desc_limit
|
232
|
-
:active
|
233
|
-
:timestamps
|
230
|
+
:name_column => :booking_name,
|
231
|
+
:name_limit => 50,
|
232
|
+
:description => true,
|
233
|
+
:desc_limit => 100,
|
234
|
+
:active => true,
|
235
|
+
:timestamps => true,
|
236
|
+
:table_options => {:primary_key => :foo}
|
234
237
|
```
|
235
238
|
|
236
239
|
is the equivalent of
|
237
240
|
|
238
241
|
```ruby
|
239
|
-
create_table :booking_statuses do |t|
|
242
|
+
create_table :booking_statuses, :primary_key => :foo do |t|
|
240
243
|
t.string :booking_name, :limit => 50, :null => false
|
241
244
|
t.string :description, :limit => 100
|
242
245
|
t.boolean :active, :null => false, :default => true
|
@@ -33,6 +33,8 @@ module PowerEnum::Schema
|
|
33
33
|
# Set this to <tt>true</tt> to have a boolean 'active' column generated. The 'active' column will have the options of NOT NULL and DEFAULT TRUE.
|
34
34
|
# [:timestamps]
|
35
35
|
# Set this to <tt>true</tt> to have timestamp columns (created_at and updated_at) generated.
|
36
|
+
# [:table_options]
|
37
|
+
# A hash of options to pass to the 'create_table' method.
|
36
38
|
#
|
37
39
|
# You can also pass in a block that takes a table object as an argument, like <tt>create_table</tt>.
|
38
40
|
#
|
@@ -46,14 +48,15 @@ module PowerEnum::Schema
|
|
46
48
|
# add_index :connector_types, [:name], :unique => true
|
47
49
|
#
|
48
50
|
# ====== Advanced Enum
|
49
|
-
# create_enum :connector_type, :name_column
|
50
|
-
# :name_limit
|
51
|
-
# :description
|
52
|
-
# :desc_limit
|
53
|
-
# :active
|
54
|
-
# :timestamps
|
51
|
+
# create_enum :connector_type, :name_column => :connector,
|
52
|
+
# :name_limit => 50,
|
53
|
+
# :description => true,
|
54
|
+
# :desc_limit => 100,
|
55
|
+
# :active => true,
|
56
|
+
# :timestamps => true,
|
57
|
+
# :table_options => {:primary_key => :foo}
|
55
58
|
# is the equivalent of
|
56
|
-
# create_table :connector_types do |t|
|
59
|
+
# create_table :connector_types, :primary_key => :foo do |t|
|
57
60
|
# t.string :connector, :limit => 50, :null => false
|
58
61
|
# t.string :description, :limit => 100
|
59
62
|
# t.boolean :active, :null => false, :default => true
|
@@ -82,8 +85,9 @@ module PowerEnum::Schema
|
|
82
85
|
generate_timestamps = !!options[:timestamps]
|
83
86
|
name_limit = options[:name_limit]
|
84
87
|
desc_limit = options[:desc_limit]
|
88
|
+
table_options = options[:table_options] || {}
|
85
89
|
|
86
|
-
create_table enum_table_name do |t|
|
90
|
+
create_table enum_table_name, table_options do |t|
|
87
91
|
t.string name_column, :limit => name_limit, :null => false
|
88
92
|
if generate_description
|
89
93
|
t.string :description, :limit => desc_limit
|
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.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Squires
|
@@ -12,34 +12,36 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain:
|
14
14
|
- !binary |-
|
15
|
-
|
16
|
-
|
15
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURpakNDQW5LZ0F3SUJB
|
16
|
+
Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJGTVJjd0ZRWURWUVFEREE1aGNu
|
17
17
|
Um8KZFhJdWMyaGhaMkZzYkRFVk1CTUdDZ21TSm9tVDhpeGtBUmtXQldkdFlX
|
18
|
-
|
19
|
-
|
18
|
+
bHNNUk13RVFZS0NaSW1pWlB5TEdRQgpHUllEWTI5dE1CNFhEVEUwTURNd01U
|
19
|
+
QXlNVGN6TkZvWERURTFNRE13TVRBeU1UY3pORm93UlRFWE1CVUdBMVVFCkF3
|
20
20
|
d09ZWEowYUhWeUxuTm9ZV2RoYkd3eEZUQVRCZ29Ka2lhSmsvSXNaQUVaRmdW
|
21
21
|
bmJXRnBiREVUTUJFR0NnbVMKSm9tVDhpeGtBUmtXQTJOdmJUQ0NBU0l3RFFZ
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
22
|
+
SktvWklodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUs1Twp5QzN5ZjYz
|
23
|
+
SEhRRVdaeG9xa3YvWWkzanVacnRDRFZVUEo4K1c3WXVkTFo3N3FKZ29INjVo
|
24
|
+
RW51TmY1YWlCYjBaCnZRTjdRTE9jQlh6dDBiVU5MaT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d0eFA5THEr
|
40
|
+
WmFvRDIvaApHZUFNV0Urb2pITjVZZjl5Y3g3NldpZy9oeHZHWjd5MWRVQTg5
|
41
|
+
L2xKOGNVV2ZuUytGU0lMVm5tSXJoUGZyRHF3CmluWG9GdW5CNzJFTDZvcHd1
|
42
|
+
a2M3Y0Q5cFVtc05zVjBIZEFTdENHNWpPaGM1VHhMMVpYaFg4UXFlMmlOb25n
|
43
|
+
PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
|
44
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
43
45
|
dependencies:
|
44
46
|
- !ruby/object:Gem::Dependency
|
45
47
|
name: rails
|
@@ -188,3 +190,4 @@ specification_version: 4
|
|
188
190
|
summary: Allows you to treat instances of your ActiveRecord models as though they
|
189
191
|
were an enumeration of values
|
190
192
|
test_files: []
|
193
|
+
has_rdoc:
|
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
p� &P^�ЋD�+���kS�rK�Y�f?o��G���s�A�44���ҁ�^�����
|
2
|
+
�G�
|