c3po 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,16 +1,17 @@
1
1
  C3PO
2
2
  ====
3
3
 
4
- Ruby translator client. Actual provider :
4
+ Ruby translator client.
5
+
6
+ Current backends :
5
7
 
6
8
  * Google Translate
7
9
  * Bing Translate
8
10
 
9
11
  Ruby 1.9.2 is strongly recommanded.
10
12
 
11
-
12
- Dependency
13
- ----------
13
+ Dependencies
14
+ ------------
14
15
 
15
16
  `libcurl4-gnutls-dev`
16
17
 
@@ -55,13 +56,9 @@ translator.is # => :en
55
56
  translator.is?(:de) # => false
56
57
  ```
57
58
 
58
- Todo
59
- ----
60
-
61
- * More specs
62
- * Use it
63
-
64
59
  Copyright
65
60
  ---------
66
61
 
67
- See LICENSE for further details.
62
+ Copyright (c) 2011 af83
63
+
64
+ Released under the MIT license
@@ -16,7 +16,11 @@ class C3po
16
16
  # @since 0.0.1
17
17
  #
18
18
  def translate(from, to)
19
- @result.translation ||= fetch @adaptor.build_query(from, to)
19
+ if @result.send(to)
20
+ @result.send(to)
21
+ else
22
+ @result.send("#{to}=", fetch(@adaptor.build_query(from, to)))
23
+ end
20
24
  end
21
25
 
22
26
  # Grab languages list from provider.
@@ -1,7 +1,9 @@
1
1
  # encoding: utf-8
2
+ require 'ostruct'
3
+
2
4
  class C3po
3
5
  module Translator
4
- class Result < Struct.new(:translation, :language, :languages)
6
+ class Result < OpenStruct
5
7
  end # Result
6
8
  end # Translator
7
9
  end # C3po
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ class C3po
3
+ VERSION = "0.1.1"
4
+ end
5
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c3po
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-27 00:00:00.000000000Z
12
+ date: 2012-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &20830440 !ruby/object:Gem::Requirement
16
+ requirement: &16812760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *20830440
24
+ version_requirements: *16812760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: typhoeus
27
- requirement: &20829960 !ruby/object:Gem::Requirement
27
+ requirement: &16812260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.2.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *20829960
35
+ version_requirements: *16812260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &20829500 !ruby/object:Gem::Requirement
38
+ requirement: &16811760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.5.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *20829500
46
+ version_requirements: *16811760
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yajl-ruby
49
- requirement: &20829040 !ruby/object:Gem::Requirement
49
+ requirement: &16811200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,25 +54,23 @@ dependencies:
54
54
  version: 0.8.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *20829040
57
+ version_requirements: *16811200
58
58
  description: Ruby translation client
59
59
  email: jboyer@af83.com
60
60
  executables: []
61
61
  extensions: []
62
- extra_rdoc_files:
63
- - README.md
62
+ extra_rdoc_files: []
64
63
  files:
65
64
  - LICENSE
66
65
  - README.md
67
- - Gemfile
68
66
  - lib/c3po.rb
69
- - lib/c3po/translator/configuration.rb
67
+ - lib/c3po/client.rb
68
+ - lib/c3po/translator.rb
70
69
  - lib/c3po/translator/bing.rb
70
+ - lib/c3po/translator/configuration.rb
71
71
  - lib/c3po/translator/google.rb
72
72
  - lib/c3po/translator/result.rb
73
- - lib/c3po/client.rb
74
- - lib/c3po/translator.rb
75
- - init.rb
73
+ - lib/c3po/version.rb
76
74
  homepage:
77
75
  licenses: []
78
76
  post_install_message:
@@ -93,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
91
  version: '0'
94
92
  requirements: []
95
93
  rubyforge_project:
96
- rubygems_version: 1.8.6
94
+ rubygems_version: 1.8.10
97
95
  signing_key:
98
96
  specification_version: 3
99
97
  summary: Ruby translation client
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec
data/init.rb DELETED
@@ -1,2 +0,0 @@
1
- # encoding: utf-8
2
- require "c3po"