indofix 0.3.0 → 0.4.0

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: 0f22f9dfc320c9aa36388a2a10a7f203387782c5
4
- data.tar.gz: 48b1d484a4d859d622af51dfc1c7d66f38bb1ccb
3
+ metadata.gz: 68e2b4d24a2ba3d35fe2e7a0701296ff5944a029
4
+ data.tar.gz: 640ac2ab6f4fe4005104aa8e58110422699d0a03
5
5
  SHA512:
6
- metadata.gz: a314a9d6661b62853d952181597e18549a91583d27fd9e4cadbc7b41691dd690266940e0f9532ff85ff3678ebf78a2e1527fd51a3bfaf8221f27a6e995284f04
7
- data.tar.gz: f7f4665c7b8a91ca816c6878326f75db009561faa8a2b774453190bf489bfca17de88b0d8f91959e5ff64f1b9e1ca8006f793ecde3dd34028cdf74d086ee7c15
6
+ metadata.gz: 3c37f21ff6b19b54832064e79404507d748aff7ca0e092d36c46e1edcbe67e4e50276d1d8aac4088d244197d0f9087f281460884e2360b26a60736145048bfc6
7
+ data.tar.gz: 6a45fc2d9c8a6f0d07b39a52dbf283358fc4a7f14e5f99a3ca77857338b0ed5fbf287c8632d4e009805b79c2fba2fc7bf037e5a8643607b467af5f185af990eb
@@ -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.nil? || !string.nil?)
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(Error, "Indofix Error")
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
@@ -1,3 +1,3 @@
1
1
  module Indofix
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-04-29 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: verbal_expressions