yatran 0.1.2 → 0.1.3
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.
- data/README.md +4 -2
- data/lib/yatran/cli.rb +1 -1
- data/lib/yatran/version.rb +1 -1
- data/spec/class_methods_spec.rb +7 -0
- data/spec/language_methods_spec.rb +11 -0
- data/spec/translate_methods_spec.rb +19 -0
- metadata +11 -7
- data/spec/string_spec.rb +0 -25
data/README.md
CHANGED
@@ -16,8 +16,6 @@ Examples
|
|
16
16
|
=> "Bonjour tout le monde!"
|
17
17
|
1.9.2p320 :006 > "Hello world".en_ru.ru_it
|
18
18
|
=> "Ciao, mondo!"
|
19
|
-
1.9.2p320 :007 > "Hello world".en_ru.ru_it.language
|
20
|
-
=> "it"
|
21
19
|
1.9.2p320 :009 > "Hello world".respond_to?("en_ru")
|
22
20
|
=> true
|
23
21
|
1.9.2p320 :010 > "Hello world".respond_to?("from_en_to_ru")
|
@@ -25,6 +23,10 @@ Examples
|
|
25
23
|
1.9.2p320 :011 > "Hello world".respond_to?("to_ru_from_en")
|
26
24
|
=> true
|
27
25
|
|
26
|
+
Detect with language method
|
27
|
+
|
28
|
+
1.9.2p320 :007 > "Hello world".en_ru.ru_it.language
|
29
|
+
=> "it"
|
28
30
|
|
29
31
|
|
30
32
|
Arrays also includes Yatran::Translatable module
|
data/lib/yatran/cli.rb
CHANGED
data/lib/yatran/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
string = "string"
|
4
|
+
array = [string, string]
|
5
|
+
|
6
|
+
Yatran::LANGUAGES_TRANSLATIONS.each do |lang|
|
7
|
+
pairs = lang.split "-"
|
8
|
+
pairs.size.should == 2
|
9
|
+
pairs.each do |l|
|
10
|
+
l.length.should == 2
|
11
|
+
end
|
12
|
+
[string, array].each do |obj|
|
13
|
+
describe obj do
|
14
|
+
it { should respond_to "from_#{pairs[0]}_to_#{pairs[1]}" }
|
15
|
+
it { should respond_to "to_#{pairs[1]}_from_#{pairs[0]}" }
|
16
|
+
it { should respond_to "#{pairs[0]}_#{pairs[1]}" }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yatran
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-09-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &70116243433380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70116243433380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70116243432760 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70116243432760
|
36
36
|
description: ! 'unofficial http://api.yandex.ru/translate API Client for ruby '
|
37
37
|
email:
|
38
38
|
- fedoronchuk@gmail.com
|
@@ -56,8 +56,10 @@ files:
|
|
56
56
|
- lib/yatran/translatable.rb
|
57
57
|
- lib/yatran/url.rb
|
58
58
|
- lib/yatran/version.rb
|
59
|
+
- spec/class_methods_spec.rb
|
60
|
+
- spec/language_methods_spec.rb
|
59
61
|
- spec/spec_helper.rb
|
60
|
-
- spec/
|
62
|
+
- spec/translate_methods_spec.rb
|
61
63
|
- yatran.gemspec
|
62
64
|
homepage: https://github.com/Fivell/yatran
|
63
65
|
licenses: []
|
@@ -84,5 +86,7 @@ signing_key:
|
|
84
86
|
specification_version: 3
|
85
87
|
summary: automatic translations and language detecting
|
86
88
|
test_files:
|
89
|
+
- spec/class_methods_spec.rb
|
90
|
+
- spec/language_methods_spec.rb
|
87
91
|
- spec/spec_helper.rb
|
88
|
-
- spec/
|
92
|
+
- spec/translate_methods_spec.rb
|
data/spec/string_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
string = "string"
|
4
|
-
|
5
|
-
describe string do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
it { should respond_to :language }
|
10
|
-
it { should respond_to :lang }
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Yatran::LANGUAGES_TRANSLATIONS.each do |lang|
|
15
|
-
pairs = lang.split "-"
|
16
|
-
|
17
|
-
it { should respond_to "from_#{pairs[0]}_to_#{pairs[1]}" }
|
18
|
-
it { should respond_to "to_#{pairs[1]}_from_#{pairs[0]}" }
|
19
|
-
it { should respond_to "#{pairs[0]}_#{pairs[1]}" }
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
end
|