apion 0.1.5 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0291858b99115fa883e48381b0c99454e5383093
4
- data.tar.gz: 4199f54a8c888b449c9f93482b32cb5c5774f187
3
+ metadata.gz: 4fe97c3e77a0297037373830862452c6ece1c23e
4
+ data.tar.gz: 5053c6b686f7b2bad1560a669e93b44a88c7ef06
5
5
  SHA512:
6
- metadata.gz: eb85aa8d165f26ee1da9fae375b20ba9f6f503fa0e4395031abc6066ec8a8307094b9e8c4e16c532d782b97681f2296ea3979c2f3a8c866369d3342337d86632
7
- data.tar.gz: 19cb88d655fec743350fa0f28ca6039c4457e40840ab9b06f9eb4e94fea76a75cce424436c2b074923467713275b7882d262676abd1470e8f2ee64cc1a98e507
6
+ metadata.gz: 41ac98774ddab4ac9b20e29d806b988fbd5d0ff64a4da307cd0d1ad984ffc8b65f5f9ef22cfdea719c01a968ce3dc4daca931da2ba29e1067c34e3da45b500b9
7
+ data.tar.gz: f7c2a441b6d1cb24b4609ecf1688b57477cf601ce3b2dee5d39e342c66e674d45ef0f05559658d6120ece91b88bf0fe3acaa64d9c3b845bdb4e11e78ebc82a3b
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.5'
4
- s.date = '2013-09-05'
3
+ s.version = '0.1.6'
4
+ s.date = '2013-09-06'
5
5
  s.summary = "Apion"
6
6
  s.description = "Easy-to-use Fr/Api translator"
7
7
  s.authors = ["Galaad Gauthier"]
data/lib/apion.rb CHANGED
@@ -7,6 +7,7 @@ module Apion
7
7
 
8
8
  ROOT = File.expand_path("../..", __FILE__)
9
9
  eval(File.read("#{ROOT}/lib/special_chars.rb"))
10
+ @timeout = 1
10
11
 
11
12
  def Apion.parseCSV(path)
12
13
  Hash[File.open("#{ROOT}/data/#{path}.csv").read.split("\n").map {|ligne| ligne.split("#")}]
@@ -20,11 +21,19 @@ module Apion
20
21
  @conversion ||= parseCSV "conversion"
21
22
  end
22
23
 
24
+ def Apion.set_timeout(seconds)
25
+ @timeout = seconds
26
+ end
27
+
28
+ def Apion.timeout
29
+ @timeout
30
+ end
31
+
23
32
  def Apion.apion(texte)
24
33
  texte = texte.downcase
25
34
  texte.gsub(SPE, "").split.map do |mot|
26
35
  exceptions[mot] || "".tap do |result|
27
- Timeout::timeout(1) do
36
+ Timeout::timeout(timeout) do
28
37
  conversion.select { |regle| mot =~ /#{regle}/ }.first.tap do |regle, api|
29
38
  mot.sub! /#{regle}/, ""
30
39
  result << api.to_s
data/lib/special_chars.rb CHANGED
@@ -1 +1 @@
1
- SPE = /([(0-9)|•|—|–|\-|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
1
+ SPE = /([(0-9)|•|—|–|\-|,|?|!|^|\r|’|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
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.5
4
+ version: 0.1.6
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-05 00:00:00.000000000 Z
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json