active_enum 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -5,12 +5,12 @@ module ActiveEnum
|
|
5
5
|
class I18nStore < MemoryStore
|
6
6
|
def get_by_id(id)
|
7
7
|
row = _values.assoc(id)
|
8
|
-
[ id, translate(row[1]) ] if row
|
8
|
+
[ id, translate(row[1]), row[2] ].compact if row
|
9
9
|
end
|
10
10
|
|
11
11
|
def get_by_name(name)
|
12
12
|
row = _values.rassoc(name.to_s)
|
13
|
-
[ row[0], translate(row[1]) ] if row
|
13
|
+
[ row[0], translate(row[1]), row[2] ].compact if row
|
14
14
|
end
|
15
15
|
|
16
16
|
def values
|
data/lib/active_enum/version.rb
CHANGED
@@ -87,6 +87,13 @@ describe ActiveEnum::Storage::I18nStore do
|
|
87
87
|
store.get_by_id(1).should == [1, 'Testing']
|
88
88
|
end
|
89
89
|
|
90
|
+
it 'should return the value with meta for a given id' do
|
91
|
+
I18n.locale = :en
|
92
|
+
|
93
|
+
store.set 1, 'test', :description => 'meta'
|
94
|
+
store.get_by_id(1).should == [1, 'Testing', { :description => 'meta' }]
|
95
|
+
end
|
96
|
+
|
90
97
|
it 'should return nil when id not found' do
|
91
98
|
store.get_by_id(1).should be_nil
|
92
99
|
end
|
@@ -102,6 +109,11 @@ describe ActiveEnum::Storage::I18nStore do
|
|
102
109
|
store.get_by_name('test').should == [1, 'Testing']
|
103
110
|
end
|
104
111
|
|
112
|
+
it 'should return the value with meta for a given name' do
|
113
|
+
store.set 1, 'test', :description => 'meta'
|
114
|
+
store.get_by_name('test').should == [1, 'Testing', { :description => 'meta' }]
|
115
|
+
end
|
116
|
+
|
105
117
|
it 'should return nil when name not found' do
|
106
118
|
store.get_by_name('test').should be_nil
|
107
119
|
end
|
@@ -54,8 +54,8 @@ describe ActiveEnum::Storage::MemoryStore do
|
|
54
54
|
|
55
55
|
describe "#get_by_id" do
|
56
56
|
it 'should return the value for a given id' do
|
57
|
-
store.set 1, 'test name'
|
58
|
-
store.get_by_id(1).should == [1, 'test name']
|
57
|
+
store.set 1, 'test name', :description => 'meta'
|
58
|
+
store.get_by_id(1).should == [1, 'test name', {:description => "meta"}]
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should return nil when id not found' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 47
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 10
|
10
|
+
version: 0.9.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Meehan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-18 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|