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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df7226fead004e6f695fda5589f7ccf069579cfe
4
- data.tar.gz: 1ffe8195e08f7468aac7f66ca82448fa5039c297
3
+ metadata.gz: b86a9199b181239e752411d423764f57bb60f431
4
+ data.tar.gz: 743bf1cedb88954e8a747d4506dae2a9a2d89874
5
5
  SHA512:
6
- metadata.gz: a0511067845ba9e81c6e7fe4c126dc1b8c9acc5fdec1eb40c8dca5aca4edca37438870f097f1ccc7c007ded1d74355390729678d5f5ce4f52081dd5b3607f66c
7
- data.tar.gz: fc5e5945bf1e866d912cac4104c758cc920c80fbbbbe6d89e933c8752f896a3aed5baba13dda20f22e9caa3b77e4ece2bbe9c5f8759051c4f09548a92c5f9de8
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.size > 1 ? parts.map(&:to_s).map(&:freeze) : [nil, parts[0].to_s.freeze]
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)
@@ -1,3 +1,3 @@
1
1
  module Titlezilla
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
@@ -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.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-24 00:00:00.000000000 Z
11
+ date: 2014-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack