i18n-recursive-lookup 0.0.2 → 0.0.4

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.
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module RecursiveLookup
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -9,7 +9,6 @@ module I18n
9
9
  protected
10
10
 
11
11
  def lookup(locale, key, scope = [], options = {})
12
-
13
12
  result = super
14
13
 
15
14
  return result unless (result.is_a?(String) or result.is_a?(Hash))
@@ -25,28 +24,32 @@ module I18n
25
24
 
26
25
  #subject is hash or string
27
26
  def deep_compile(locale, subject, options)
28
- if subject.is_a?(String)
29
- compile(locale, subject, options)
30
- else
27
+ if subject.is_a?(Hash)
31
28
  subject.each do |key, object|
32
29
  subject[key], had_to_compile_result = deep_compile(locale, object, options)
33
30
  end
31
+ else
32
+ compile(locale, subject, options)
34
33
  end
35
34
  end
36
35
 
37
36
  def compile(locale, string, options)
38
37
  had_to_compile_result = false
39
38
 
40
- result = string.split(TOKENIZER).map do |token|
41
- embedded_token = token.match(INTERPOLATION_SYNTAX_PATTERN)
42
-
43
- if embedded_token
44
- had_to_compile_result = true
45
- handle_interpolation_match(locale, embedded_token, options)
46
- else
47
- token
48
- end
49
- end.join
39
+ if string.is_a?(String)
40
+ result = string.split(TOKENIZER).map do |token|
41
+ embedded_token = token.match(INTERPOLATION_SYNTAX_PATTERN)
42
+
43
+ if embedded_token
44
+ had_to_compile_result = true
45
+ handle_interpolation_match(locale, embedded_token, options)
46
+ else
47
+ token
48
+ end
49
+ end.join
50
+ else
51
+ result = string
52
+ end
50
53
 
51
54
  [result, had_to_compile_result]
52
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-recursive-lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
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: 2013-02-14 00:00:00.000000000 Z
12
+ date: 2013-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: mocha
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -70,7 +86,7 @@ extra_rdoc_files: []
70
86
  files:
71
87
  - lib/i18n-recursive-lookup/version.rb
72
88
  - lib/i18n/backend/recursive_lookup.rb
73
- homepage: https://github.com//i18n-recursive-lookup
89
+ homepage: https://github.com/annkissam/i18n-recursive-lookup
74
90
  licenses: []
75
91
  post_install_message:
76
92
  rdoc_options: []