indofix 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/indofix.rb +29 -4
- data/lib/indofix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68e2b4d24a2ba3d35fe2e7a0701296ff5944a029
|
4
|
+
data.tar.gz: 640ac2ab6f4fe4005104aa8e58110422699d0a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c37f21ff6b19b54832064e79404507d748aff7ca0e092d36c46e1edcbe67e4e50276d1d8aac4088d244197d0f9087f281460884e2360b26a60736145048bfc6
|
7
|
+
data.tar.gz: 6a45fc2d9c8a6f0d07b39a52dbf283358fc4a7f14e5f99a3ca77857338b0ed5fbf287c8632d4e009805b79c2fba2fc7bf037e5a8643607b467af5f185af990eb
|
data/lib/indofix.rb
CHANGED
@@ -3,6 +3,7 @@ require "indofix/indofix_nomina_helper"
|
|
3
3
|
require "indofix/indofix_other_helper"
|
4
4
|
require "indofix/indofix_verba_helper"
|
5
5
|
require "indofix/indofix_kpst_helper"
|
6
|
+
require "indofix/errors"
|
6
7
|
|
7
8
|
module Indofix
|
8
9
|
class << self
|
@@ -26,8 +27,13 @@ module Indofix
|
|
26
27
|
def check_other
|
27
28
|
@check_other ||= IndofixOtherHelper.new
|
28
29
|
end
|
30
|
+
|
31
|
+
def error
|
32
|
+
@error ||= Error.new
|
33
|
+
end
|
29
34
|
|
30
35
|
# Let's start check
|
36
|
+
#
|
31
37
|
# options:
|
32
38
|
# * nomina
|
33
39
|
# * verba
|
@@ -35,7 +41,7 @@ module Indofix
|
|
35
41
|
# * kpst
|
36
42
|
def check(params, string)
|
37
43
|
@result = {}
|
38
|
-
if (!params.
|
44
|
+
if (!params.empty? && !string.empty?)
|
39
45
|
case params
|
40
46
|
when 'nomina'
|
41
47
|
@result = nomina_probe(string)
|
@@ -48,7 +54,26 @@ module Indofix
|
|
48
54
|
end
|
49
55
|
@result.keys
|
50
56
|
else
|
51
|
-
raise(
|
57
|
+
raise(error, "Params and String cannot Empty")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Let's check all possibilities at once
|
62
|
+
#
|
63
|
+
# Params String
|
64
|
+
# Return Hash
|
65
|
+
def stupid_check(string)
|
66
|
+
@result = {}
|
67
|
+
if !string.empty?
|
68
|
+
@nomina = nomina_probe(string)
|
69
|
+
@verba = verba_probe(string)
|
70
|
+
@other = other_probe(string)
|
71
|
+
@kpst = kpst_probe(string)
|
72
|
+
hashes = [@nomina, @verba, @other, @kpst]
|
73
|
+
|
74
|
+
@result = Hash[*hashes.map(&:to_a).flatten]
|
75
|
+
else
|
76
|
+
raise(error, "String cannot empty/nil")
|
52
77
|
end
|
53
78
|
end
|
54
79
|
|
@@ -71,7 +96,7 @@ module Indofix
|
|
71
96
|
@detected = Hash.new
|
72
97
|
kpst.each do |method|
|
73
98
|
transform = check_kpst.send(method, string)
|
74
|
-
@detected[transform] = method.to_s unless transform.nil?
|
99
|
+
@detected[transform[1]] = method.to_s unless transform.nil?
|
75
100
|
end
|
76
101
|
return @detected
|
77
102
|
end
|
@@ -83,7 +108,7 @@ module Indofix
|
|
83
108
|
@detected = Hash.new
|
84
109
|
verba.each do |method|
|
85
110
|
transform = check_verba.send(method, string)
|
86
|
-
@detected[transform] = method.to_s unless transform.nil?
|
111
|
+
@detected[transform[1]] = method.to_s unless transform.nil?
|
87
112
|
end
|
88
113
|
return @detected
|
89
114
|
end
|
data/lib/indofix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indofix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muhammad K. Huda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: verbal_expressions
|