phrase 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/phrase.rb CHANGED
@@ -18,7 +18,7 @@ module Phrase
18
18
  Thread.current[:phrase_config] = value
19
19
  end
20
20
 
21
- %w(enabled backend prefix suffix auth_token client_version js_host js_use_ssl cache_key_segments_initial cache_lifetime).each do |method|
21
+ %w(enabled backend prefix suffix auth_token client_version js_host js_use_ssl cache_key_segments_initial cache_lifetime ignored_keys).each do |method|
22
22
  module_eval <<-DELEGATORS, __FILE__, __LINE__ + 1
23
23
  def #{method}
24
24
  config.#{method}
@@ -20,7 +20,7 @@ class Phrase::Backend::PhraseService
20
20
 
21
21
  protected
22
22
  def to_be_translated_without_phrase?(args)
23
- Phrase.disabled? or has_been_given_blacklisted_key?(args) or has_been_forced_to_resolve_with_phrase?(args)
23
+ Phrase.disabled? or has_been_given_blacklisted_key?(args) or has_been_given_ignored_key?(args) or has_been_forced_to_resolve_with_phrase?(args)
24
24
  end
25
25
 
26
26
  def has_been_given_blacklisted_key?(args)
@@ -28,6 +28,11 @@ protected
28
28
  has_blacklist_entry_for_key?(key)
29
29
  end
30
30
 
31
+ def has_been_given_ignored_key?(args)
32
+ key = given_key_from_args(args)
33
+ key_is_ignored?(key)
34
+ end
35
+
31
36
  def has_been_forced_to_resolve_with_phrase?(args)
32
37
  (args.last.is_a?(Hash) and args.last[:resolve] == false)
33
38
  end
@@ -42,6 +47,13 @@ protected
42
47
  end
43
48
  false
44
49
  end
50
+
51
+ def key_is_ignored?(key)
52
+ Phrase.ignored_keys.each do |ignored_key|
53
+ return true if present?(key.to_s[/\A#{ignored_key.gsub("*", ".*")}\Z/])
54
+ end
55
+ false
56
+ end
45
57
 
46
58
  def blacklisted_keys
47
59
  @blacklisted_keys ||= api_client.fetch_blacklisted_keys
data/lib/phrase/config.rb CHANGED
@@ -83,4 +83,12 @@ class Phrase::Config
83
83
  def cache_lifetime=(cache_lifetime)
84
84
  @@cache_lifetime = cache_lifetime
85
85
  end
86
- end
86
+
87
+ def ignored_keys
88
+ @@ignored_keys ||= []
89
+ end
90
+
91
+ def ignored_keys=(ignored_keys)
92
+ @@ignored_keys = ignored_keys
93
+ end
94
+ end
@@ -1,3 +1,3 @@
1
1
  module Phrase
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
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.3.6
4
+ version: 0.3.7
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: 2013-03-27 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70301928636500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *70301928636500
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: json
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70301928636040 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *70301928636040
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: rake
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70301928635620 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: '0'
54
44
  type: :development
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *70301928635620
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: rspec
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &70301928635200 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ! '>='
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: '0'
70
55
  type: :development
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
57
+ version_requirements: *70301928635200
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: i18n
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &70301928634780 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '0'
86
66
  type: :development
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
68
+ version_requirements: *70301928634780
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: webmock
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &70301928634360 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,15 +76,10 @@ dependencies:
101
76
  version: '0'
102
77
  type: :development
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
79
+ version_requirements: *70301928634360
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: vcr
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &70301928633880 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
85
  - - ! '>='
@@ -117,15 +87,10 @@ dependencies:
117
87
  version: '0'
118
88
  type: :development
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
90
+ version_requirements: *70301928633880
126
91
  - !ruby/object:Gem::Dependency
127
92
  name: timecop
128
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &70301928633420 !ruby/object:Gem::Requirement
129
94
  none: false
130
95
  requirements:
131
96
  - - ! '>='
@@ -133,12 +98,7 @@ dependencies:
133
98
  version: '0'
134
99
  type: :development
135
100
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
101
+ version_requirements: *70301928633420
142
102
  description: phrase allows you to edit translations in-place on the page itself. More
143
103
  information at phraseapp.com
144
104
  email:
@@ -233,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
193
  version: 1.3.6
234
194
  requirements: []
235
195
  rubyforge_project: phrase
236
- rubygems_version: 1.8.24
196
+ rubygems_version: 1.8.10
237
197
  signing_key:
238
198
  specification_version: 3
239
199
  summary: The best way to manage i18n.