serial_translator 0.0.1 → 0.0.2

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: 597ebe3f2c16e2d5c2253570aa6e2bc3fb2743f4
4
- data.tar.gz: 4f54a88c540d09761c79663f7ba20bdca089fad7
3
+ metadata.gz: 2d9a361ac3956ed0f39ecda9c4ef8a791d73e648
4
+ data.tar.gz: 61bf47fefc8860f5b4ff7891150c76bac52fae9d
5
5
  SHA512:
6
- metadata.gz: 971fdbcbf302aa42934d7b859c1d42ea5abe848597891979249f298f51fd97e0c07ed434dba5326cfb1874b6ca1001b01b9f7de2714fdaff0b8bd68e51b96733
7
- data.tar.gz: aea5ed5d8467ad104d25f0fcc0492724936e15c322dff460f63488bb160d4720f9fb90495461216e36dbbdb2ec1c7a1aa46ccc61b8a561ea0bb1f79ac7b9a5d2
6
+ metadata.gz: 5aa2be05d525d8786cb8bfdc8c2484e321cf49c0434bc5ae06f2a69a1be9606525cd0bb3eb90bec82ba94d580ea2b2d0049762300ca097d7c7f221ea2939a449
7
+ data.tar.gz: 6e86c7ecb095ee16134e39826ca43655cb0e6fc4ac784a6cc81129cc2dd20d522968c6f0144f6ff90d14f9e59c3b97d6b7be86a68d95feae09379db07623bd00
@@ -55,4 +55,8 @@ module SerialTranslator
55
55
  def translations_for(attribute)
56
56
  __send__(:"#{attribute}_translations") || {}
57
57
  end
58
+
59
+ def translated_into?(locale)
60
+ translated_locales.include?(locale.to_sym)
61
+ end
58
62
  end
@@ -1,3 +1,3 @@
1
1
  module SerialTranslator
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -72,4 +72,20 @@ describe SerialTranslator do
72
72
  object.translated_locales.should eq [:en]
73
73
  end
74
74
  end
75
+
76
+ describe '#translated_into?' do
77
+ before { object.title_translations = { en: 'Foo', de: '' } }
78
+
79
+ it 'returns true if there is a translation available for this locale' do
80
+ object.should be_translated_into :en
81
+ end
82
+
83
+ it 'returns false if there is no translation present for this locale' do
84
+ object.should_not be_translated_into :de
85
+ end
86
+
87
+ it 'returns false if this locale is unknown yet' do
88
+ object.should_not be_translated_into :yml
89
+ end
90
+ end
75
91
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serial_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace development team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-06 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel