titlezilla 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/lib/titlezilla/translator.rb +6 -1
- data/lib/titlezilla/version.rb +1 -1
- data/test/translator_test.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b86a9199b181239e752411d423764f57bb60f431
|
4
|
+
data.tar.gz: 743bf1cedb88954e8a747d4506dae2a9a2d89874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b3f176b14501205bf99041b208868206aa4ed4f2ac82309655f85da770609fddced5b90b69c4db4bc9ba2cb5bfb31d69165ed81df6f02c79f2ec7b5436f926
|
7
|
+
data.tar.gz: 8533306134666c3f7a96602d3f44c4985d527543389f471f3e0c9770c85333144a6d56a4204f564f009429b7440298657292e2bd34ec14e3104cd409732d3541
|
@@ -30,7 +30,12 @@ module Titlezilla
|
|
30
30
|
|
31
31
|
def parse_namespace_and_controller_name(controller_path)
|
32
32
|
parts = controller_path.to_s.split('/')
|
33
|
-
parts.
|
33
|
+
parts.map!(&:to_s).map!(&:freeze)
|
34
|
+
if parts.size > 1
|
35
|
+
[parts[(0...-1)], parts[-1]]
|
36
|
+
else
|
37
|
+
[nil, parts[0].to_s.freeze]
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
def lookup(*key)
|
data/lib/titlezilla/version.rb
CHANGED
data/test/translator_test.rb
CHANGED
@@ -15,12 +15,12 @@ module Titlezilla
|
|
15
15
|
|
16
16
|
it 'should initialize namespace' do
|
17
17
|
t = Translator.new('admin/main', 'index')
|
18
|
-
t.namespace.must_equal 'admin'
|
18
|
+
t.namespace.must_equal ['admin']
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should initialize from symbols' do
|
22
22
|
t = Translator.new(:'admin/main', :index)
|
23
|
-
t.namespace.must_equal 'admin'
|
23
|
+
t.namespace.must_equal ['admin']
|
24
24
|
t.controller_name.must_equal 'main'
|
25
25
|
t.action_name.must_equal 'index'
|
26
26
|
end
|
@@ -39,6 +39,12 @@ module Titlezilla
|
|
39
39
|
t.title.must_equal 'Index'
|
40
40
|
end
|
41
41
|
|
42
|
+
it 'should lookup action title with deep namespace' do
|
43
|
+
load_translations({ admin: { billing: { main: { index: 'Index' } } } })
|
44
|
+
t = Translator.new('admin/billing/main', :index)
|
45
|
+
t.title.must_equal 'Index'
|
46
|
+
end
|
47
|
+
|
42
48
|
it 'should lookup mapped actions title' do
|
43
49
|
load_translations({ main: { new: 'New' } })
|
44
50
|
t = Translator.new(:main, :create)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: titlezilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeny Likholetov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03
|
11
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|