enumerate_it 1.0.1 → 1.0.2

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (1.0.1)
4
+ enumerate_it (1.0.2)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -51,6 +51,10 @@ module EnumerateIt
51
51
  self.const_get(value.to_sym)
52
52
  end
53
53
 
54
+ def self.keys
55
+ enumeration.keys
56
+ end
57
+
54
58
  def self.key_for(value)
55
59
  enumeration.map {|e| e[0] if e[1][0] == value }.compact.first
56
60
  end
@@ -8,6 +8,7 @@ module EnumerateIt
8
8
  set_validations attribute, options
9
9
  create_enumeration_humanize_method options[:with], attribute
10
10
  store_enumeration options[:with], attribute
11
+
11
12
  if options[:create_helpers]
12
13
  create_helper_methods options[:with], attribute, options[:create_helpers]
13
14
  create_mutator_methods options[:with], attribute, options[:create_helpers]
@@ -1,3 +1,3 @@
1
1
  module EnumerateIt
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -334,6 +334,12 @@ describe EnumerateIt::Base do
334
334
  end
335
335
  end
336
336
 
337
+ describe ".keys" do
338
+ it "returns a list with the keys used to define the enumeration" do
339
+ TestEnumeration.keys.should == [:value_1, :value_2, :value_3]
340
+ end
341
+ end
342
+
337
343
  describe ".key_for" do
338
344
  it "returns the key for the given value inside the enumeration" do
339
345
  TestEnumeration.key_for(TestEnumeration::VALUE_1).should == :value_1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-10 00:00:00.000000000 Z
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: 4432600982721649974
127
+ hash: 709884351936478852
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 4432600982721649974
136
+ hash: 709884351936478852
137
137
  requirements: []
138
138
  rubyforge_project:
139
139
  rubygems_version: 1.8.24