acts_as_enum 1.3.1 → 1.4.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
  SHA1:
3
- metadata.gz: 5888e81dd18fb0832ad8e639d84d264fe39b6f91
4
- data.tar.gz: e9884a4ca6a4cdf1a59aa2fff0ffde0a5b4ccaa7
3
+ metadata.gz: 5fc3b3070cca09d3473828a02c8f632d33fec65a
4
+ data.tar.gz: 6c560f8fa20a1863ea9002785ea170ef1964c2b2
5
5
  SHA512:
6
- metadata.gz: 31048e7265e118b8b46a4181e1d0f8c918174b393df80c832fa14e28f1c6fa09e5ff48fd739e03a0ff3a120fa1d30a8ec60949665525394ebb2ae4d55c162462
7
- data.tar.gz: 77ce481f5b5f41b85fd2c4629a9fce99e61690bb167c4151a85d4d5697ad4ebc2cada54024cfcf5949fcd3d00ff3fcac088edb621060ebfae60c6e55d7abd2bd
6
+ metadata.gz: 07a65f0581b46b0380a08fc0892d5222e16feb151bc3989179858e085b326c09f737e7dc823bb69fb6885067d05c67be7260c1380f5cb5e0dcead4e7d01f7f31
7
+ data.tar.gz: a5fb55a2785003f3daa46d4589cf54621be6ac26269f5b935b6cf185034df9b67f6db852e9d0269dafdc1b1f862624c609fac13502c24f8de8c84700a2652318
data/MIT-LICENSE CHANGED
File without changes
data/README.rdoc CHANGED
@@ -38,11 +38,11 @@ Table column type as String
38
38
  Or
39
39
 
40
40
  class User < ActiveRecord::Base
41
- acts_as_enum :status, :in => { 'disable' => '冻结', { 'enable', '激活' }
41
+ acts_as_enum :status, :in => { 'disable' => '冻结', 'enable' => '激活' }
42
42
  end
43
43
 
44
44
  class User < ActiveRecord::Base
45
- enum_attr :status, :in => { 'disable' => '冻结', { 'enable', '激活' }
45
+ enum_attr :status, :in => { 'disable' => '冻结', 'enable' => '激活' }
46
46
  end
47
47
 
48
48
  Table column type as Integer
data/Rakefile CHANGED
File without changes
data/TODO CHANGED
File without changes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.1
1
+ 1.4.0
data/init.rb CHANGED
File without changes
data/lib/acts_as_enum.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  # acts_as_enum :status, :in => [ ['disable', '冻结'], ['enable', '激活'] ]
16
16
  # end
17
17
  # class User < ActiveRecord::Base
18
- # acts_as_enum :status, :in => { 'disable' => '冻结', { 'enable', '激活' }
18
+ # acts_as_enum :status, :in => { 'disable' => '冻结', 'enable' => '激活' }
19
19
  # end
20
20
  #
21
21
  # and type is Integer or number of string
@@ -69,7 +69,11 @@ module ActsAsEnum
69
69
  end
70
70
 
71
71
  attr_options = enum.each_with_object({}) do |arr, hash|
72
- hash[arr[-2]] = arr.last.to_s
72
+ if arr.count == 2
73
+ hash[arr.last.to_s] = arr.last.to_s
74
+ else
75
+ hash[arr[-2]] = arr.last.to_s
76
+ end
73
77
  end
74
78
  const_set(plural_upcase_attr, attr_options)
75
79
 
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Liang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2018-04-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: For multiple values activerecord attributes. This gem have some very
14
14
  useful methods and constants for attribute.
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: 1.3.4
46
46
  requirements: []
47
47
  rubyforge_project: acts_as_enum
48
- rubygems_version: 2.6.6
48
+ rubygems_version: 2.4.3
49
49
  signing_key:
50
50
  specification_version: 4
51
51
  summary: Enum Attribute for Rails ActiveRecord