graphql-rails-i18n 0.1 → 0.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
  SHA256:
3
- metadata.gz: f0b90d5534c7c2d5d09a73ea5bf13f963a4bd6835a867c6c3e81e944f11ace85
4
- data.tar.gz: f51d456806a54485379df05b966a6e7ffac618a4ac80cda90c90590dfa193baf
3
+ metadata.gz: f52423dbe5fc8e4f717d8c356929f7edbe2e464e4100117bc6db55b8e6990bfc
4
+ data.tar.gz: 316a3a03dc6edfc2e406bdf49055d30510fe4f3a49a376da6059dbf48e0ec31a
5
5
  SHA512:
6
- metadata.gz: d60650cf3b4adc149e7db68113ac1e803bf010764e644e0ebaa0480d62112622a07ef2bf51fc39b35ae174b1d8845c438dfdaf8c01d313fb40140db2e0185dfc
7
- data.tar.gz: 2e4d77836f1d3984f64838122ad7b0339920ab3643a957f93af623ba09391c805881c35524efe00e339aaba30c1b86d3ac8f0ef8eb0bc785c0885c5118f6bb4e
6
+ metadata.gz: cbbdb2e492a3e7774c93c105b42da84d4af73a1075ad62d12c03812a541084cd8c68cbdb7194e5f75b7aa4620e5b0044b226df9eec70c72d8a11f315f0e149af
7
+ data.tar.gz: 38661b2413561aed98d1417ef84a9571d4643d5104ec53e98d1f248a4f9c14a9d672176698fe072d68192af9654932125f96d7df5749f84eef5539f748c1c0bd
@@ -1,21 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class GraphQL::Schema::Directive::Locale < GraphQL::Schema::Directive
4
- class LocaleEnum < GraphQL::Schema::Enum
5
- def self.locale(codename:, description: '')
6
- value(codename.underscore, description: description, value: codename)
7
- end
8
- end
3
+ module GraphQL
4
+ class Schema
5
+ class Directive
6
+ class Locale < GraphQL::Schema::Directive
7
+ class LocaleEnum < GraphQL::Schema::Enum
8
+ def self.locale(codename:, description: '')
9
+ value(codename.underscore, description: description, value: codename)
10
+ end
11
+ end
9
12
 
10
- locations GraphQL::Schema::Directive::FIELD
13
+ locations GraphQL::Schema::Directive::FIELD
11
14
 
12
- attr_accessor :locale_enum
15
+ attr_accessor :locale_enum
13
16
 
14
- argument :lang, type: LocaleEnum, required: false
17
+ argument :lang, type: LocaleEnum, required: false
15
18
 
16
- def self.resolve(object, argument, context)
17
- I18n.with_locale(argument[:lang]) do
18
- yield
19
+ def self.resolve(_object, argument, _context)
20
+ I18n.with_locale(argument[:lang]) do
21
+ yield
22
+ end
23
+ end
24
+ end
19
25
  end
20
26
  end
21
27
  end
@@ -21,7 +21,6 @@ describe GraphQL::Schema::Directive::Locale do
21
21
  directive(GraphQL::Schema::Directive::Locale)
22
22
 
23
23
  query(Query)
24
- # only supported by the interpreter
25
24
  use GraphQL::Execution::Interpreter
26
25
  end
27
26
 
@@ -47,13 +46,14 @@ describe GraphQL::Schema::Directive::Locale do
47
46
 
48
47
  context 'when @locale directive is not used' do
49
48
  it 'does not call I18n.with_locale' do
49
+ expect(I18n).not_to receive(:with_locale)
50
+
50
51
  str = '{
51
52
  result: localizedHello
52
53
  }'
53
54
 
54
55
  res = LocaleSchema.execute(str)
55
56
 
56
- expect(I18n).not_to receive(:with_locale)
57
57
  expect(res['data']['result']).to eq('Hello in default language')
58
58
  end
59
59
  end
@@ -4,5 +4,5 @@ require 'rubygems'
4
4
  require 'bundler'
5
5
  Bundler.require
6
6
 
7
- require "graphql"
8
- require "graphql-rails-i18n"
7
+ require 'graphql'
8
+ require 'graphql-rails-i18n'
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-rails-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Law
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.49'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.49'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: graphql
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ">="
31
+ - - '='
18
32
  - !ruby/object:Gem::Version
19
- version: 1.9.pre2
33
+ version: 1.9.pre3
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ">="
38
+ - - '='
25
39
  - !ruby/object:Gem::Version
26
- version: 1.9.pre2
40
+ version: 1.9.pre3
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rails
29
43
  requirement: !ruby/object:Gem::Requirement