phrase 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/phrase/extensions/base.rb +3 -5
- data/lib/phrase/extensions/hash.rb +20 -22
- data/lib/phrase/extensions/string.rb +3 -5
- data/phrase.gemspec +1 -1
- metadata +4 -4
@@ -3,10 +3,8 @@
|
|
3
3
|
module Phrase::Extensions::Base
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
Phrase.backend.translate(*args)
|
9
|
-
end
|
10
|
-
alias_method :t, :translate
|
6
|
+
def translate(*args)
|
7
|
+
Phrase.backend.translate(*args)
|
11
8
|
end
|
9
|
+
alias_method :t, :translate
|
12
10
|
end
|
@@ -3,31 +3,29 @@
|
|
3
3
|
module Phrase::Extensions::Hash
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
shallow_hash[[key, sub_key].join(".")] = sub_value
|
12
|
-
end
|
13
|
-
else
|
14
|
-
shallow_hash[key.to_s] = value
|
6
|
+
def to_shallow_hash
|
7
|
+
self.inject({}) do |shallow_hash, (key, value)|
|
8
|
+
if value.is_a?(Hash)
|
9
|
+
value.to_shallow_hash.each do |sub_key, sub_value|
|
10
|
+
shallow_hash[[key, sub_key].join(".")] = sub_value
|
15
11
|
end
|
16
|
-
|
12
|
+
else
|
13
|
+
shallow_hash[key.to_s] = value
|
17
14
|
end
|
15
|
+
shallow_hash
|
18
16
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
def deep_stringify_keys
|
20
|
+
inject({}) { |result, (key, value)|
|
21
|
+
value = value.deep_stringify_keys if value.is_a?(Hash)
|
22
|
+
unless value.is_a? Proc
|
23
|
+
result[(key.to_s rescue key) || key] = value
|
24
|
+
else
|
25
|
+
result[(key.to_s rescue key) || key] = nil
|
26
|
+
end
|
27
|
+
result
|
28
|
+
}
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
@@ -3,11 +3,9 @@
|
|
3
3
|
module Phrase::Extensions::String
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
{item => hash}
|
10
|
-
end
|
6
|
+
def expand_to_hash(value=nil)
|
7
|
+
self.split('.').reverse.inject(value) do |hash, item|
|
8
|
+
{item => hash}
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
data/phrase.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phrase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70098913523960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70098913523960
|
25
25
|
description: phrase allows you to edit translations inline, on the page itself. More
|
26
26
|
information at phraseapp.com
|
27
27
|
email:
|