phraseapp-in-context-editor-ruby 1.4.0 → 2.0.0

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +7 -11
  3. data/.gitignore +0 -1
  4. data/.tool-versions +1 -1
  5. data/CODEOWNERS +1 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +241 -0
  8. data/Guardfile +13 -13
  9. data/README.md +81 -51
  10. data/RELEASING.md +10 -0
  11. data/lib/generators/phraseapp_in_context_editor/install_generator.rb +3 -9
  12. data/lib/generators/phraseapp_in_context_editor/templates/phraseapp_in_context_editor.rb +9 -17
  13. data/lib/phraseapp-in-context-editor-ruby/adapters/fast_gettext.rb +20 -20
  14. data/lib/phraseapp-in-context-editor-ruby/adapters/i18n.rb +10 -10
  15. data/lib/phraseapp-in-context-editor-ruby/backend_service.rb +12 -99
  16. data/lib/phraseapp-in-context-editor-ruby/config.rb +13 -50
  17. data/lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb +13 -15
  18. data/lib/phraseapp-in-context-editor-ruby/delegate/i18n_delegate.rb +4 -50
  19. data/lib/phraseapp-in-context-editor-ruby/delegate.rb +13 -14
  20. data/lib/phraseapp-in-context-editor-ruby/engine.rb +5 -6
  21. data/lib/phraseapp-in-context-editor-ruby/view_helpers.rb +25 -19
  22. data/lib/phraseapp-in-context-editor-ruby.rb +15 -54
  23. data/phraseapp-in-context-editor-ruby.gemspec +18 -33
  24. metadata +27 -101
  25. data/lib/generators/phraseapp_in_context_editor/templates/README +0 -10
  26. data/lib/phraseapp-in-context-editor-ruby/api_collection.rb +0 -41
  27. data/lib/phraseapp-in-context-editor-ruby/api_wrapper.rb +0 -59
  28. data/lib/phraseapp-in-context-editor-ruby/cache.rb +0 -37
  29. data/lib/phraseapp-in-context-editor-ruby/displayable_key_identifier.rb +0 -46
  30. data/lib/phraseapp-in-context-editor-ruby/fallback_keys_fetcher.rb +0 -44
  31. data/lib/phraseapp-in-context-editor-ruby/hash_flattener.rb +0 -53
  32. data/lib/phraseapp-in-context-editor-ruby/key_names_cache.rb +0 -53
  33. data/lib/phraseapp-in-context-editor-ruby/version.rb +0 -5
@@ -1,11 +1,8 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'phraseapp-in-context-editor-ruby/api_collection'
3
- require 'phraseapp-in-context-editor-ruby/delegate/i18n_delegate'
1
+ require_relative "delegate/i18n_delegate"
4
2
 
5
3
  module PhraseApp
6
4
  module InContextEditor
7
5
  class BackendService
8
-
9
6
  attr_accessor :blacklisted_keys
10
7
 
11
8
  def initialize(args = {})
@@ -40,47 +37,20 @@ module PhraseApp
40
37
  end
41
38
  end
42
39
 
43
- protected
44
- def to_be_translated_without_phraseapp?(args)
45
- PhraseApp::InContextEditor.disabled? or has_been_given_blacklisted_key?(args) or has_been_given_ignored_key?(args) or has_been_forced_to_resolve_with_phraseapp?(args)
46
- end
47
-
48
- def has_been_given_blacklisted_key?(args)
49
- key = given_key_from_args(args)
50
- has_blacklist_entry_for_key?(key)
51
- end
40
+ protected
52
41
 
53
- def has_been_given_ignored_key?(args)
54
- key = given_key_from_args(args)
55
- key_is_ignored?(key)
42
+ def to_be_translated_without_phraseapp?(args)
43
+ PhraseApp::InContextEditor.disabled? || has_been_forced_to_resolve_with_phraseapp?(args)
56
44
  end
57
45
 
58
46
  def has_been_forced_to_resolve_with_phraseapp?(args)
59
- (args.last.is_a?(Hash) and args.last[:resolve] == false)
47
+ (args.last.is_a?(Hash) && args.last[:resolve] == false)
60
48
  end
61
49
 
62
50
  def given_key_from_args(args)
63
51
  extract_normalized_key_from_args(args)
64
52
  end
65
53
 
66
- def has_blacklist_entry_for_key?(key)
67
- blacklisted_keys.each do |blacklisted_key|
68
- return true if present?(key.to_s[/\A#{blacklisted_key.gsub("*", ".*")}\Z/])
69
- end
70
- false
71
- end
72
-
73
- def key_is_ignored?(key)
74
- PhraseApp::InContextEditor.ignored_keys.each do |ignored_key|
75
- return true if present?(key.to_s[/\A#{ignored_key.gsub("*", ".*")}\Z/])
76
- end
77
- false
78
- end
79
-
80
- def blacklisted_keys
81
- @blacklisted_keys ||= api_wrapper.blacklisted_keys
82
- end
83
-
84
54
  def phraseapp_delegate_for(args)
85
55
  key = given_key_from_args(args)
86
56
  return nil unless present?(key)
@@ -95,15 +65,14 @@ module PhraseApp
95
65
  end
96
66
 
97
67
  def transform_args(args)
98
- duped_args = args.map { |item| (item.is_a?(Symbol) or item.nil?) ? item : item.dup }
99
- transform_args_based_on_caller(duped_args)
68
+ duped_args = args.map { |item| (item.is_a?(Symbol) || item.nil?) ? item : item.dup }
100
69
  end
101
70
 
102
71
  def normalized_key(duped_args)
103
72
  splitted_args = split_args(duped_args)
104
73
  key = I18n::Backend::Flatten.normalize_flat_keys(*splitted_args)
105
74
  key.gsub!("..", ".")
106
- key.gsub!(/^\./, '')
75
+ key.gsub!(/^\./, "")
107
76
  key
108
77
  end
109
78
 
@@ -111,77 +80,21 @@ module PhraseApp
111
80
  options = options_from_args(args)
112
81
  key ||= args.shift
113
82
  locale = options.delete(:locale) || I18n.locale
114
- return [locale, key, options[:scope], nil]
83
+ [locale, key, options[:scope], nil]
115
84
  end
116
85
 
117
86
  def options_from_args(args)
118
87
  args.last.is_a?(Hash) ? args.pop : {}
119
88
  end
120
89
 
121
- def transform_args_based_on_caller(args)
122
- translation_caller = identify_caller
123
-
124
- if translation_caller and args.first =~ /^\./
125
- options = options_from_args(args)
126
-
127
- if not present?(options[:scope]) and present?(translation_caller)
128
- options[:scope] = translation_caller
129
- end
130
-
131
- args.push(options)
132
- parts = args.first.to_s.split(".").select { |e| not blank?(e) }
133
- args[0] = parts[0] if parts.size == 1
134
- end
135
-
136
- args
137
- end
138
-
139
- def identify_caller
140
- translation_caller = nil
141
- send(:caller)[0..6].each do |intermediate_caller|
142
- translation_caller = calling_template(intermediate_caller) unless translation_caller
143
- end
144
-
145
- if present?(translation_caller)
146
- find_lookup_scope(translation_caller)
147
- else
148
- nil
149
- end
150
- end
151
-
152
- def calling_template(string)
153
- string.match(/(views)(\/.+)(?>:[0-9]+:in)/)
154
- end
155
-
156
90
  def blank?(str)
157
- raise "blank?(str) can only be given a String or nil" unless str.is_a?(String) or str.nil?
158
- str.nil? or str == ''
91
+ raise "blank?(str) can only be given a String or nil" unless str.is_a?(String) || str.nil?
92
+ str.nil? || str == ""
159
93
  end
160
94
 
161
95
  def present?(str)
162
- raise "present?(str) can only be given a String or nil" unless str.is_a?(String) or str.nil?
163
- not blank?(str)
164
- end
165
-
166
- def find_lookup_scope(caller)
167
- split_path = caller[2][1..-1].split(".")[0].split("/")
168
-
169
- template_or_partial = remove_underscore_form_partial(split_path[-1])
170
- split_path[-1] = template_or_partial
171
-
172
- split_path.map!(&:to_sym)
173
- end
174
-
175
- def remove_underscore_form_partial(template_or_partial)
176
- if template_or_partial.to_s[0,1] == "_"
177
- template_or_partial.to_s[1..-1]
178
- else
179
- template_or_partial.to_s
180
- end
181
- end
182
-
183
- def api_wrapper
184
- @api_wrapper ||= PhraseApp::InContextEditor::ApiWrapper.new
96
+ raise "present?(str) can only be given a String or nil" unless str.is_a?(String) || str.nil?
97
+ !blank?(str)
185
98
  end
186
99
  end
187
100
  end
@@ -1,62 +1,39 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module PhraseApp
3
2
  module InContextEditor
4
3
  class Config
5
4
  CONFIG_OPTIONS = {
5
+ account_id: nil,
6
6
  project_id: nil,
7
- access_token: nil,
7
+ datacenter: "eu",
8
8
  enabled: false,
9
- skip_ssl_verification: false,
10
9
  backend: PhraseApp::InContextEditor::BackendService.new,
11
10
  prefix: "{{__",
12
- suffix: "__}}",
13
- api_host: "https://api.phrase.com",
14
- js_host: "phraseapp.com",
15
- js_use_ssl: true,
16
- js_path: "/assets/in-context-editor/2.0/app.js",
17
- js_options: {},
18
- cache_key_segments_initial: ["simple_form"],
19
- cache_lifetime: 300,
20
- ignored_keys: [],
11
+ suffix: "__}}"
21
12
  }.freeze
22
13
 
23
- CONFIG_OPTIONS_GLOBAL_ONLY = [
24
- :access_token,
25
- :skip_ssl_verification,
26
- :api_host
27
- ].freeze
28
-
29
14
  CONFIG_OPTIONS.each do |option, default_value|
30
- class_eval "@@#{option} = CONFIG_OPTIONS[:#{option}]"
15
+ class_eval "@@#{option} = CONFIG_OPTIONS[:#{option}]", __FILE__, __LINE__
31
16
 
32
17
  define_method("#{option}=") do |value|
33
- instance_eval "@#{option} = value; self.class.invalidate_api_client"
34
- end unless CONFIG_OPTIONS_GLOBAL_ONLY.include?(option)
18
+ instance_eval "@#{option} = value", __FILE__, __LINE__
19
+ end
35
20
 
36
- define_method("#{option}") do
37
- instance_eval "defined?(@#{option}) ? @#{option} : self.class.#{option}"
21
+ define_method(option.to_s) do
22
+ instance_eval "defined?(@#{option}) ? @#{option} : self.class.#{option}", __FILE__, __LINE__
38
23
  end
39
24
 
40
25
  define_singleton_method("#{option}=") do |value|
41
- instance_eval "@@#{option} = value; invalidate_api_client"
26
+ instance_eval "@@#{option} = value", __FILE__, __LINE__
42
27
  end
43
28
 
44
- define_singleton_method("#{option}") do
45
- instance_eval "@@#{option}"
29
+ define_singleton_method(option.to_s) do
30
+ instance_eval "@@#{option}", __FILE__, __LINE__
46
31
  end
47
32
  end
48
33
 
49
- def self.api_client
50
- @@api_client ||= build_api_client
51
- end
52
-
53
- def api_client
54
- self.class.api_client
55
- end
56
-
57
- def assign_values(config_options={})
34
+ def assign_values(config_options = {})
58
35
  config_options.each do |config_option, value|
59
- self.send("#{config_option}=", value)
36
+ send("#{config_option}=", value)
60
37
  end
61
38
  end
62
39
 
@@ -65,20 +42,6 @@ module PhraseApp
65
42
  send("#{option}=", default_value)
66
43
  end
67
44
  end
68
-
69
- protected
70
- def self.invalidate_api_client
71
- @@api_client = nil
72
- end
73
-
74
- def self.build_api_client
75
- credentials = PhraseApp::Auth::Credentials.new(
76
- token: @@access_token,
77
- host: @@api_host,
78
- skip_ssl_verification: @@skip_ssl_verification
79
- )
80
- PhraseApp::Client.new(credentials)
81
- end
82
45
  end
83
46
  end
84
47
  end
@@ -1,6 +1,4 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- require 'phraseapp-in-context-editor-ruby/delegate'
1
+ require_relative "../delegate"
4
2
 
5
3
  module PhraseApp
6
4
  module InContextEditor
@@ -12,20 +10,20 @@ module PhraseApp
12
10
  @display_key = params[:msgid]
13
11
  end
14
12
 
15
- private
13
+ private
14
+
16
15
  def params_from_args(args)
17
- params = case @method
18
- when :_
19
- {msgid: args.first}
20
- when :n_
21
- {msgid: args.first, msgid_plural: args[1], count: args.last}
22
- when :s_
23
- {msgid: args.first}
24
- else
25
- self.class.log("Unsupported FastGettext method #{@method}")
26
- {}
16
+ case @method
17
+ when :_
18
+ {msgid: args.first}
19
+ when :n_
20
+ {msgid: args.first, msgid_plural: args[1], count: args.last}
21
+ when :s_
22
+ {msgid: args.first}
23
+ else
24
+ self.class.log("Unsupported FastGettext method #{@method}")
25
+ {}
27
26
  end
28
- params
29
27
  end
30
28
  end
31
29
  end
@@ -1,12 +1,4 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- require 'phraseapp-in-context-editor-ruby/cache'
4
- require 'phraseapp-in-context-editor-ruby/hash_flattener'
5
- require 'phraseapp-in-context-editor-ruby/delegate'
6
- require 'phraseapp-in-context-editor-ruby/api_wrapper'
7
- require 'phraseapp-in-context-editor-ruby/displayable_key_identifier'
8
-
9
- require 'set'
1
+ require_relative "../delegate"
10
2
 
11
3
  module PhraseApp
12
4
  module InContextEditor
@@ -14,11 +6,11 @@ module PhraseApp
14
6
  class I18nDelegate < Base
15
7
  attr_accessor :key, :display_key, :options, :api_client, :fallback_keys, :original_args
16
8
 
17
- def initialize(key, options={}, original_args=nil)
9
+ def initialize(key, options = {}, original_args = nil)
18
10
  @key = key
19
11
  @options = options
20
12
  @original_args = original_args
21
- @display_key = DisplayableKeyIdentifier.new(api_wrapper).identify(@key, @options)
13
+ @display_key = @key
22
14
  super(decorated_key_name)
23
15
  end
24
16
 
@@ -27,7 +19,7 @@ module PhraseApp
27
19
  if @key.respond_to?(args.first)
28
20
  to_s.send(*args)
29
21
  else
30
- data = translation_or_subkeys
22
+ data = [@key]
31
23
  if data.respond_to?(args.first)
32
24
  data.send(*args, &block)
33
25
  else
@@ -37,44 +29,6 @@ module PhraseApp
37
29
  end
38
30
  end
39
31
  end
40
-
41
- private
42
-
43
- def translation_or_subkeys
44
- return nil if @key.nil? || @key.to_s == ""
45
-
46
- keys = api_wrapper.keys_with_prefix(@key)
47
- return nil unless keys.present?
48
-
49
- if keys.size == 1
50
- translation_content_for_key(keys.first)
51
- else
52
- translation_hash = keys.inject({}) do |hash, key|
53
- hash[key.name] = translation_content_for_key(key)
54
- hash
55
- end
56
-
57
- PhraseApp::InContextEditor::HashFlattener.expand_flat_hash(translation_hash, @key)
58
- end
59
- end
60
-
61
- def translation_content_for_key(key)
62
- default_translations = api_wrapper.default_translation(key)
63
- return unless default_translations.present?
64
-
65
- if key.plural
66
- default_translations.inject({}) do |hash, translation|
67
- hash[translation.plural_suffix.to_sym] = translation.content
68
- hash
69
- end
70
- else
71
- default_translations.first.content
72
- end
73
- end
74
-
75
- def api_wrapper
76
- @api_wrapper ||= InContextEditor::ApiWrapper.new
77
- end
78
32
  end
79
33
  end
80
34
  end
@@ -1,17 +1,15 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
1
  module PhraseApp
4
2
  module InContextEditor
5
3
  module Delegate
6
4
  class Base < String
7
5
  def to_s
8
- "#{decorated_key_name}"
6
+ decorated_key_name.to_s
9
7
  end
10
- alias :camelize :to_s
11
- alias :underscore :to_s
12
- alias :classify :to_s
13
- alias :dasherize :to_s
14
- alias :tableize :to_s
8
+ alias_method :camelize, :to_s
9
+ alias_method :underscore, :to_s
10
+ alias_method :classify, :to_s
11
+ alias_method :dasherize, :to_s
12
+ alias_method :tableize, :to_s
15
13
 
16
14
  # Delegate .html_safe from accessing Delegate object as if it was a hash,
17
15
  # but instead perform it on the resulting string
@@ -19,23 +17,24 @@ module PhraseApp
19
17
 
20
18
  def self.log(message)
21
19
  message = "phrase: #{message}"
22
- if defined?(Rails) and Rails.respond_to?(:logger)
20
+ if defined?(Rails) && Rails.respond_to?(:logger)
23
21
  Rails.logger.warn(message)
24
22
  else
25
- $stderr.puts message
23
+ warn message
26
24
  end
27
25
  end
28
26
 
29
- protected
27
+ protected
28
+
30
29
  def decorated_key_name
31
30
  "#{PhraseApp::InContextEditor.prefix}phrase_#{normalized_display_key}#{PhraseApp::InContextEditor.suffix}"
32
31
  end
33
32
 
34
33
  def normalized_display_key
35
- unless @display_key.nil?
36
- @display_key.gsub("<", "[[[[[[html_open]]]]]]").gsub(">", "[[[[[[html_close]]]]]]")
37
- else
34
+ if @display_key.nil?
38
35
  @display_key
36
+ else
37
+ @display_key.gsub("<", "[[[[[[html_open]]]]]]").gsub(">", "[[[[[[html_close]]]]]]")
39
38
  end
40
39
  end
41
40
  end
@@ -1,14 +1,13 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'phraseapp-in-context-editor-ruby'
3
- require 'i18n'
1
+ require "phraseapp-in-context-editor-ruby"
2
+ require "i18n"
4
3
 
5
4
  if defined? Rails
6
5
  module PhraseApp
7
6
  module InContextEditor
8
7
  class Engine < Rails::Engine
9
- initializer 'phraseapp-in-context-editor-ruby', before: :disable_dependency_loading do |app|
10
- require 'phraseapp-in-context-editor-ruby/adapters/i18n'
11
- require 'phraseapp-in-context-editor-ruby/adapters/fast_gettext'
8
+ initializer "phraseapp-in-context-editor-ruby", before: :disable_dependency_loading do |app|
9
+ require "phraseapp-in-context-editor-ruby/adapters/i18n"
10
+ require "phraseapp-in-context-editor-ruby/adapters/fast_gettext"
12
11
 
13
12
  ActionView::Base.send :include, PhraseApp::InContextEditor::ViewHelpers
14
13
  end
@@ -1,35 +1,41 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  module PhraseApp
4
4
  module InContextEditor
5
5
  module ViewHelpers
6
- def phraseapp_in_context_editor_js(opts={})
6
+ def load_in_context_editor(opts = {})
7
7
  return "" unless PhraseApp::InContextEditor.enabled?
8
8
 
9
9
  # stringify to reduce possible errors when passing symbols
10
- js_default_options = PhraseApp::InContextEditor.js_options.inject({}) { |conf, (k,v)| conf[k.to_s] = v; conf}
11
- opts = opts.nil? ? {} : opts.inject({}) { |conf, (k,v)| conf[k.to_s] = v; conf}
10
+ opts = opts.nil? ? {} : opts.each_with_object({}) { |(k, v), conf|
11
+ conf[k.to_s] = v
12
+ }
12
13
 
13
14
  # js options
14
15
  configuration = {
15
- 'projectId' => PhraseApp::InContextEditor.project_id,
16
- 'prefix' => PhraseApp::InContextEditor.prefix,
17
- 'suffix' => PhraseApp::InContextEditor.suffix,
18
- 'apiBaseUrl' => "#{PhraseApp::InContextEditor.api_host}/api/v2",
19
- }.merge(js_default_options).merge(opts)
16
+ "projectId" => PhraseApp::InContextEditor.project_id,
17
+ "accountId" => PhraseApp::InContextEditor.account_id,
18
+ "datacenter" => PhraseApp::InContextEditor.datacenter,
19
+ "prefix" => PhraseApp::InContextEditor.prefix,
20
+ "suffix" => PhraseApp::InContextEditor.suffix
21
+ }.merge(opts)
20
22
 
21
- snippet = <<-eos
22
- <script>
23
- window.PHRASEAPP_CONFIG = #{configuration.to_json};
24
- (function() {
25
- var phraseapp = document.createElement('script'); phraseapp.type = 'text/javascript'; phraseapp.async = true;
26
- phraseapp.src = ['#{PhraseApp::InContextEditor.js_use_ssl ? 'https' : 'http'}://', '#{PhraseApp::InContextEditor.js_host}#{PhraseApp::InContextEditor.js_path}?', new Date().getTime()].join('');
27
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phraseapp, s);
28
- })();
29
- </script>
30
- eos
23
+ snippet = <<-EOS
24
+ <script>
25
+ window.PHRASEAPP_CONFIG = #{configuration.to_json};
26
+ (function() {
27
+ let phraseapp = document.createElement('script');
28
+ phraseapp.type = 'module';
29
+ phraseapp.async = true;
30
+ phraseapp.src = "https://d2bgdldl6xit7z.cloudfront.net/latest/ice/index.js";
31
+ let script = document.getElementsByTagName('script')[0];
32
+ script.parentNode.insertBefore(phraseapp, script);
33
+ })();
34
+ </script>
35
+ EOS
31
36
  snippet.respond_to?(:html_safe) ? snippet.html_safe : snippet
32
37
  end
38
+ alias_method :phraseapp_in_context_editor_js, :load_in_context_editor
33
39
  end
34
40
  end
35
41
  end
@@ -1,10 +1,8 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'phraseapp-ruby'
3
- require 'request_store'
1
+ require "request_store"
4
2
 
5
3
  module PhraseApp
6
4
  module InContextEditor
7
- autoload :Config, 'phraseapp-in-context-editor-ruby/config'
5
+ autoload :Config, "phraseapp-in-context-editor-ruby/config"
8
6
 
9
7
  class << self
10
8
  def config
@@ -31,24 +29,12 @@ module PhraseApp
31
29
  config.project_id
32
30
  end
33
31
 
34
- def access_token
35
- config.access_token
32
+ def account_id
33
+ config.account_id
36
34
  end
37
35
 
38
- def skip_ssl_verification
39
- config.skip_ssl_verification
40
- end
41
-
42
- def cache_key_segments_initial
43
- config.cache_key_segments_initial
44
- end
45
-
46
- def cache_lifetime
47
- config.cache_lifetime
48
- end
49
-
50
- def ignored_keys
51
- config.ignored_keys
36
+ def datacenter
37
+ config.datacenter
52
38
  end
53
39
 
54
40
  def enabled=(value)
@@ -62,38 +48,14 @@ module PhraseApp
62
48
  def disabled?
63
49
  !config.enabled
64
50
  end
65
-
66
- def js_use_ssl
67
- config.js_use_ssl
68
- end
69
-
70
- def js_host
71
- config.js_host
72
- end
73
-
74
- def js_path
75
- config.js_path
76
- end
77
-
78
- def js_options
79
- config.js_options
80
- end
81
-
82
- def api_host
83
- config.api_host
84
- end
85
-
86
- def api_client
87
- config.api_client
88
- end
89
51
  end
90
52
 
91
53
  def self.configure
92
54
  yield(PhraseApp::InContextEditor::Config)
93
55
  end
94
56
 
95
- def self.with_config(config_options={}, &block)
96
- original_config = self.config.dup
57
+ def self.with_config(config_options = {}, &block)
58
+ original_config = config.dup
97
59
  config.assign_values(config_options)
98
60
  yield
99
61
  ensure
@@ -101,17 +63,16 @@ module PhraseApp
101
63
  end
102
64
  end
103
65
 
104
- autoload :ViewHelpers, 'phraseapp-in-context-editor-ruby/view_helpers'
66
+ autoload :ViewHelpers, "phraseapp-in-context-editor-ruby/view_helpers"
105
67
 
106
- require 'phraseapp-in-context-editor-ruby/version'
107
- require 'phraseapp-in-context-editor-ruby/engine'
108
- require 'phraseapp-in-context-editor-ruby/delegate'
109
- require 'phraseapp-in-context-editor-ruby/backend_service'
110
- require 'phraseapp-in-context-editor-ruby/view_helpers'
68
+ require "phraseapp-in-context-editor-ruby/engine"
69
+ require "phraseapp-in-context-editor-ruby/delegate"
70
+ require "phraseapp-in-context-editor-ruby/backend_service"
71
+ require "phraseapp-in-context-editor-ruby/view_helpers"
111
72
  end
112
73
 
113
74
  # Only load adapters directly if non-rails app, otherwise use engine
114
75
  unless defined? Rails
115
- require 'phraseapp-in-context-editor-ruby/adapters/i18n'
116
- require 'phraseapp-in-context-editor-ruby/adapters/fast_gettext'
76
+ require "phraseapp-in-context-editor-ruby/adapters/i18n"
77
+ require "phraseapp-in-context-editor-ruby/adapters/fast_gettext"
117
78
  end