apion 0.1.6 → 0.1.7

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/apion.gemspec +2 -2
  3. data/bin/apion +2 -2
  4. data/lib/apion.rb +10 -14
  5. data/lib/string.rb +13 -0
  6. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fe97c3e77a0297037373830862452c6ece1c23e
4
- data.tar.gz: 5053c6b686f7b2bad1560a669e93b44a88c7ef06
3
+ metadata.gz: f482216b13883859deeed5d20f2e25e5a572815c
4
+ data.tar.gz: 04e234d2036e85bdfee7772cad1fd10b033431e5
5
5
  SHA512:
6
- metadata.gz: 41ac98774ddab4ac9b20e29d806b988fbd5d0ff64a4da307cd0d1ad984ffc8b65f5f9ef22cfdea719c01a968ce3dc4daca931da2ba29e1067c34e3da45b500b9
7
- data.tar.gz: f7c2a441b6d1cb24b4609ecf1688b57477cf601ce3b2dee5d39e342c66e674d45ef0f05559658d6120ece91b88bf0fe3acaa64d9c3b845bdb4e11e78ebc82a3b
6
+ metadata.gz: fcf03529b2a1ace0aa6b383c13549a30c761bc3ca2e3b8da6d71bce09b1e32c48e5ea2a1f55df84d57a663fd2f833311232d5ebd62c5e6667d2bec0864da06d5
7
+ data.tar.gz: 5d4d2e59fcb5a7ecbb9eb323fee070c97fe41241ffbe54e5d753371804c92e32fe2efa1447859e023e936ed76455cb73b176a01b85a1ed7116210a4858358c16
data/apion.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'apion'
3
- s.version = '0.1.6'
4
- s.date = '2013-09-06'
3
+ s.version = '0.1.7'
4
+ s.date = '2013-09-07'
5
5
  s.summary = "Apion"
6
6
  s.description = "Easy-to-use Fr/Api translator"
7
7
  s.authors = ["Galaad Gauthier"]
data/bin/apion CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  root = File.expand_path("../..", __FILE__)
4
- require "#{root}/lib/apion.rb"
4
+ require "#{root}/lib/string.rb"
5
5
 
6
- puts Apion.apion(ARGV[0]).join
6
+ puts ARGV[0].to_api.join
data/lib/apion.rb CHANGED
@@ -1,35 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- module Apion
3
+ class Apion
4
4
 
5
5
  require "json"
6
6
  require "timeout"
7
7
 
8
8
  ROOT = File.expand_path("../..", __FILE__)
9
9
  eval(File.read("#{ROOT}/lib/special_chars.rb"))
10
- @timeout = 1
10
+ attr_accessor :timeout
11
+
12
+ def initialize
13
+ @timeout = 0.2
14
+ end
11
15
 
12
- def Apion.parseCSV(path)
16
+ def parseCSV(path)
13
17
  Hash[File.open("#{ROOT}/data/#{path}.csv").read.split("\n").map {|ligne| ligne.split("#")}]
14
18
  end
15
19
 
16
- def Apion.exceptions
20
+ def exceptions
17
21
  @exceptions ||= JSON.parse(File.read("#{ROOT}/data/dict.json"))
18
22
  end
19
23
 
20
- def Apion.conversion
24
+ def conversion
21
25
  @conversion ||= parseCSV "conversion"
22
26
  end
23
27
 
24
- def Apion.set_timeout(seconds)
25
- @timeout = seconds
26
- end
27
-
28
- def Apion.timeout
29
- @timeout
30
- end
31
-
32
- def Apion.apion(texte)
28
+ def apion(texte)
33
29
  texte = texte.downcase
34
30
  texte.gsub(SPE, "").split.map do |mot|
35
31
  exceptions[mot] || "".tap do |result|
data/lib/string.rb ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ root = File.expand_path("../..", __FILE__)
4
+ require "#{root}/lib/apion.rb"
5
+
6
+ class String
7
+ def to_api
8
+ api = Apion.new
9
+ api.apion(self)
10
+ end
11
+ end
12
+
13
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Galaad Gauthier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2013-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -34,6 +34,7 @@ files:
34
34
  - Gemfile
35
35
  - apion.gemspec
36
36
  - lib/special_chars.rb
37
+ - lib/string.rb
37
38
  - lib/apion.rb
38
39
  - data/dict.json
39
40
  - data/conversion.csv