franc 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/franc.rb +8 -8
- data/lib/franc/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72ae17f6f20567c3c654a1a94e766cc4851ec7cc
|
4
|
+
data.tar.gz: 50bdd637bca5d0a569b5ba40ac974106601e6c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cab303ce1bd59e01c2fb3f50672f006f6e1dc3943b562105a165f9f0312adae760879eb766e7c6d589fbf8cee551b9ceed546ed1ddf3db1d4f0a2bb495329f0a
|
7
|
+
data.tar.gz: 5d5e2a2dea1677b135747b4f28493ef81743010f29eab3be9c39329a81e298c0b0f1a56ed351194e22fce8179cc7069eb7729ec04e0882b90ca90dda83168018
|
data/lib/franc.rb
CHANGED
@@ -4,11 +4,12 @@
|
|
4
4
|
# If franc is not installed globally on computer system, this will not work.
|
5
5
|
module Franc
|
6
6
|
def language(str = self)
|
7
|
-
|
7
|
+
formstr = str.gsub(/\W\s/, ' ') # Replace special chars with a space.
|
8
|
+
`franc #{formstr}`.strip!
|
8
9
|
rescue Errno::ENOENT
|
9
10
|
ask_install
|
10
11
|
end
|
11
|
-
|
12
|
+
|
12
13
|
# Asks if user would like to install franc.
|
13
14
|
def ask_install
|
14
15
|
puts 'Looks like franc has not been installed yet.'
|
@@ -16,21 +17,20 @@ module Franc
|
|
16
17
|
answer = gets.chomp!
|
17
18
|
install(answer)
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
# If user presses RETURN or gives anything besides no, franc is installed.
|
21
22
|
def install(str)
|
22
|
-
return if
|
23
|
-
puts 'installing...'
|
24
|
-
`npm install -g franc`
|
23
|
+
return if %w(no n).include?(str)
|
24
|
+
puts 'installing...'
|
25
|
+
`npm install -g franc`
|
25
26
|
puts "\nnpm successfully installed franc."
|
26
27
|
true # Just for looks really, better than returning nil.
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
# Add to String class. Now usage can be:
|
31
|
+
# Add to String class. Now usage can be:
|
31
32
|
# "example string".language
|
32
33
|
# =>"und"
|
33
34
|
class String
|
34
35
|
include Franc
|
35
36
|
end
|
36
|
-
|
data/lib/franc/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Franc
|
2
|
-
VERSION = '0.0.
|
3
|
-
end
|
2
|
+
VERSION = '0.0.3'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: franc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mason
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.4.
|
76
|
+
rubygems_version: 2.4.5.1
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Detect the language of text.
|