yinum 1.7.4 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bfe06e2e4c74e29a8558790e3fd3cbb7e9c0d88
4
- data.tar.gz: f056d6709135cb56989fe410604294e338501c61
3
+ metadata.gz: 1852e8cae1da2ec57b29129ccac0e22bd10903b5
4
+ data.tar.gz: 87ab148db37f6c7681582d3224ff86775dd96518
5
5
  SHA512:
6
- metadata.gz: c506d7599bc89186de7cd08a82b190cbd1c8ea15a50d2be068aa28301ad3454a2f0db3dc54de1189f705d005e45158091551760227574ed2e66a39353c5fbfe1
7
- data.tar.gz: bfb8f3e6a05abb31a3c690da0fde44f42fcf84f5dabb58b72c2e2129ac8e4d4b080406857c557ee66738204a17bb15ba97feb2b7d2896e7c91891cc4ea7cdd25
6
+ metadata.gz: bb0820b263ade12501ef425a1dd73b11f0e3623c2ee9bd7a8079f4bb33b46f5b096e018c2d4d720aeeb4194c015fa7613e063db7a76bf5903880a1adf2f32ca7
7
+ data.tar.gz: f8971edbac61a68d4c5bd792355885dfdb2755f52ee27b1478688856f63e215a8a9259dd732cdf73b46dbcea0ef282649887c71379c07ec3e511b766c91d41c7
data/CHANGELOG.md CHANGED
@@ -20,3 +20,6 @@
20
20
  **1.7.4**
21
21
  * `attr_enum`'s reader allows super to hold the name etc.
22
22
  * Add `#attr_enum` and `#enum` only to modules and classes (not any instance).
23
+
24
+ **1.7.5**
25
+ * Alias helper methods to support Rails 4.1 overriding `::enum`.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yinum (1.7.4)
4
+ yinum (1.7.5)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -7,7 +7,7 @@ module Enum::Helpers::EnumAttribute
7
7
  # Generating attribute reader and writer to convert to EnumValue.
8
8
  # If :qualifier => true, generates questioning methods for every name in the enum.
9
9
  # If given a enum name (a symbol) and hash, also creates the enum.
10
- def attr_enum(attr, name_or_enum, options = {}, hash = nil)
10
+ def attr_yinum(attr, name_or_enum, options = {}, hash = nil)
11
11
  # the first hash is either options or the hash if the options are missing
12
12
  hash, options = options, {} unless name_or_enum.is_a?(Enum) or hash
13
13
  # generating or getting the enum
@@ -15,7 +15,7 @@ module Enum::Helpers::EnumAttribute
15
15
  e = name_or_enum
16
16
  else
17
17
  # generating the enum if the hash is not empty
18
- enum name_or_enum, hash if hash.any?
18
+ yinum name_or_enum, hash if hash.any?
19
19
  e = const_get(name_or_enum)
20
20
  end
21
21
  # attribute reader
@@ -44,6 +44,7 @@ module Enum::Helpers::EnumAttribute
44
44
 
45
45
  e
46
46
  end
47
+ alias_method :attr_enum, :attr_yinum
47
48
  end
48
49
 
49
50
  # Every module or class shall have it
@@ -8,11 +8,11 @@ module Enum::Helpers::EnumColumn
8
8
  # Creating a validation for the attribute so it must have valid enum values (allowing nil).
9
9
  # If :scoped => true, generates scopes and questioning methods for every name in the enum.
10
10
  # If given a enum name (a symbol) and hash, also creates the enum.
11
- def enum_column(attr, name_or_enum, options = {}, hash = nil)
11
+ def yinum_column(attr, name_or_enum, options = {}, hash = nil)
12
12
  # the first hash is either options or the hash if the options are missing
13
13
  hash, options = options, {} unless name_or_enum.is_a?(Enum) or hash
14
14
  # generating the enum attribute
15
- e = attr_enum(attr, name_or_enum, options.merge(:qualifier => options[:scoped]), hash)
15
+ e = attr_yinum(attr, name_or_enum, options.merge(:qualifier => options[:scoped]), hash)
16
16
  # validation
17
17
  validates_inclusion_of attr, :in => e.values, :allow_nil => true
18
18
  if options[:scoped]
@@ -24,6 +24,7 @@ module Enum::Helpers::EnumColumn
24
24
 
25
25
  e
26
26
  end
27
+ alias_method :enum_column, :yinum_column
27
28
  end
28
29
 
29
30
  if defined?(ActiveRecord::Base)
@@ -1,9 +1,10 @@
1
1
  require 'enum'
2
2
 
3
3
  module Enum::Helpers::EnumGenerator
4
- def enum(name, hash)
4
+ def yinum(name, hash)
5
5
  const_set name, Enum.new(name, self, hash)
6
6
  end
7
+ alias_method :enum, :yinum
7
8
  end
8
9
 
9
10
  # Every module or class shall have it
data/lib/enum/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Enum
2
- VERSION = '1.7.4'
2
+ VERSION = '1.7.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yinum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Niv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec