prismic_rails 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 030763302c473073372f60f32d995a426b293a79
4
- data.tar.gz: 6639648bbb9de7a8e54915247ba0c2ace859ce00
3
+ metadata.gz: 6d8aca0c6264a4a745cd2c0ca78e33d26f54b09e
4
+ data.tar.gz: 405d33ef759ce8bd33ba3cd9428bdd702d85e5b9
5
5
  SHA512:
6
- metadata.gz: 722a423e36c4ed443807990b2ca6de439756a3342da33f252034ae770da35de638c3e1caf41610723942a223ff633d93ecf6e1b20f96b07975057a8983b9f5a4
7
- data.tar.gz: fb418330dca12a1a31328d08b05440ac40d610987596d52d8ca40471855f77fcde5798dfab8b96265807d0abc138db8c835058335c9513ebd260840a643f89b4
6
+ metadata.gz: e2b2129bb76c00f26146cea2b71f7356e23ab318b496d86b49366afc757b13ed8f886d6c5c580cddd39b321fbc26ad467e9a2db504048939bccdb694624a391a
7
+ data.tar.gz: 513ba73bc5896be9db6dfbf348c9ff9533d6de784deaa41fd9ce373583daa528ac8bc304cfb618bfe39aad5bde886ab6420eb60cd54774572b4946a8faefe03a
@@ -21,8 +21,12 @@ module PrismicRails
21
21
 
22
22
  # Calls the PrismicRails::LanguageService with a i18n locale form rails. The
23
23
  # PrismicRails::LanguageService tries to match it into a prismic locale.
24
- def self.call(locale)
25
- new(locale).match()
24
+ def self.call(locale, reverse: false)
25
+ if reverse
26
+ new(locale).reverse()
27
+ else
28
+ new(locale).match()
29
+ end
26
30
  end
27
31
 
28
32
  # Creates a instance of the class PrismicRails::LanguageService
@@ -35,6 +39,11 @@ module PrismicRails
35
39
  return language_hash[@locale.to_sym] || '*'
36
40
  end
37
41
 
42
+ # Tries to reverse match the prismic locale to a rails locale
43
+ def reverse
44
+ return language_hash.key(@locale)
45
+ end
46
+
38
47
  # Creates the language hash out of the PrismicRails::Config
39
48
  def language_hash
40
49
  HashWithIndifferentAccess.new(PrismicRails.config.languages)
@@ -1,5 +1,5 @@
1
1
  # :nodoc:
2
2
  module PrismicRails
3
3
  # :nodoc:
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prismic_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Langenegger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2018-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prismic.io
@@ -231,7 +231,6 @@ files:
231
231
  - lib/prismic_rails/services/language_service.rb
232
232
  - lib/prismic_rails/services/query_service.rb
233
233
  - lib/prismic_rails/version.rb
234
- - prismic_rails.gemspec
235
234
  homepage: https://github.com/fadendaten/prismic_rails
236
235
  licenses:
237
236
  - MIT
@@ -1,37 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'prismic_rails/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "prismic_rails"
8
- spec.version = PrismicRails::VERSION
9
- spec.authors = ["Felix Langenegger"]
10
- spec.email = ["f.langenegger@fadendaten.ch"]
11
-
12
- spec.summary = %q{PrismicRails provides rails view helpers to query prismic.io.}
13
- spec.description = %q{With PrismicRails it is simple to query the prismic.io API for a defined custom type. By providing rails helpers the integration in your rails view is much easier as before.}
14
- spec.homepage = "https://github.com/fadendaten/prismic_rails"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(test|spec|features)/})
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_runtime_dependency "prismic.io", "~> 1.5", ">= 1.5"
25
- spec.add_runtime_dependency "rails", ">= 4.2"
26
-
27
- spec.add_development_dependency "bundler", "~> 1.14"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
-
31
- spec.add_development_dependency "rdoc", "~> 5.1", ">= 5.1"
32
- spec.add_development_dependency "vcr", "~> 3.0.3", ">= 3.0.3"
33
- spec.add_development_dependency "dotenv", "~> 2.2", ">= 2.2.1"
34
- spec.add_development_dependency "webmock", "~> 3.0", ">= 3.0.1"
35
- spec.add_development_dependency 'simplecov', "~> 0.14", ">= 0.14.1"
36
- spec.add_development_dependency 'pry', '~> 0.10.4'
37
- end