ojad 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +15 -4
- data/lib/ojad/cli.rb +5 -1
- data/lib/ojad/result.rb +8 -5
- data/lib/ojad/{verb_presenter.rb → verb.rb} +14 -16
- data/lib/ojad/verbs.rb +4 -2
- data/lib/ojad/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f60eabada133af27007812427975c8dcc7eac8f0f1c74ee0e42dff5b968c20ee
|
4
|
+
data.tar.gz: d409aa62676e1603fc437eeca502ea6bbc98673dc09c48d57f81bd0ad6aa9d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87627a5d3772cb2fd370d45db729f8ec7b67cb6169e0e071e6a945a1dc5be1466d7e06131faa55aed865fba90642ca244b1b60722f38916b9e8cdc052bd4db1
|
7
|
+
data.tar.gz: adc0d0c23b2fde8a5135b82afa48349e6880aee730ab1e6f71a31a96d4ff8b6d18b343a367dc9172606857fc744134257589ee10b12b28f7d0e57018ca6c0c0a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ A Ruby Client to interact with [OJAD][ojad].
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem
|
10
|
+
gem "ojad"
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -21,9 +21,20 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
```
|
24
|
-
ojad
|
25
|
-
|
26
|
-
|
24
|
+
$ ojad くる
|
25
|
+
Group: 来る・来ます
|
26
|
+
Dictionary: くる
|
27
|
+
Polite: きます
|
28
|
+
Te: きて
|
29
|
+
Ta: きた
|
30
|
+
Negative: こない
|
31
|
+
Past negative: こなかった
|
32
|
+
Ba: くれば
|
33
|
+
Causative: こさせる
|
34
|
+
Passive: こられる
|
35
|
+
Imperative: こい
|
36
|
+
Potential: こられる
|
37
|
+
Volitional: こよう
|
27
38
|
```
|
28
39
|
|
29
40
|
## Development
|
data/lib/ojad/cli.rb
CHANGED
@@ -14,13 +14,17 @@ module OJAD
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def start
|
17
|
-
|
17
|
+
$stdout.puts(result_for_human)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
22
|
attr_reader :arguments
|
23
23
|
|
24
|
+
def result_for_human
|
25
|
+
Result.new(response).to_human
|
26
|
+
end
|
27
|
+
|
24
28
|
def response
|
25
29
|
Client.call(arguments.first)
|
26
30
|
end
|
data/lib/ojad/result.rb
CHANGED
@@ -10,10 +10,7 @@ module OJAD
|
|
10
10
|
|
11
11
|
def to_human
|
12
12
|
if response.success?
|
13
|
-
|
14
|
-
verb.to_human
|
15
|
-
puts "-"*80
|
16
|
-
end
|
13
|
+
verbs_for_human
|
17
14
|
else
|
18
15
|
error_message
|
19
16
|
end
|
@@ -23,17 +20,23 @@ module OJAD
|
|
23
20
|
|
24
21
|
attr_reader :response
|
25
22
|
|
23
|
+
LINE = "-"*80
|
24
|
+
|
26
25
|
def html
|
27
26
|
@_response_string ||= response.body.to_s
|
28
27
|
end
|
29
28
|
|
29
|
+
def verbs_for_human
|
30
|
+
verbs.map(&:to_human).join(LINE)
|
31
|
+
end
|
32
|
+
|
30
33
|
def verbs
|
31
34
|
Verbs.new(html).to_a
|
32
35
|
end
|
33
36
|
|
34
37
|
def error_message
|
35
38
|
"An error occurred. Please try again later.\n\n" \
|
36
|
-
"Response body:\n\n#{response.body.to_s}"
|
39
|
+
"Response body:\n\n#{response.body.to_s}"
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
@@ -1,27 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "nokogiri"
|
4
|
-
|
5
3
|
module OJAD
|
6
|
-
class
|
4
|
+
class Verb
|
7
5
|
def initialize(document)
|
8
6
|
@document = document
|
9
7
|
end
|
10
8
|
|
11
9
|
def to_human
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
"Group: #{group}\n" \
|
11
|
+
"Dictionary: #{dictionary}\n" \
|
12
|
+
"Polite: #{polite}\n" \
|
13
|
+
"Te: #{te}\n" \
|
14
|
+
"Ta: #{ta}\n" \
|
15
|
+
"Negative: #{negative}\n" \
|
16
|
+
"Past negative: #{past_negative}\n" \
|
17
|
+
"Ba: #{ba}\n" \
|
18
|
+
"Causative: #{causative}\n" \
|
19
|
+
"Passive: #{passive}\n" \
|
20
|
+
"Imperative: #{imperative}\n" \
|
21
|
+
"Potential: #{potential}\n" \
|
22
|
+
"Volitional: #{volitional}\n"
|
25
23
|
end
|
26
24
|
|
27
25
|
private
|
data/lib/ojad/verbs.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
require_relative "verb"
|
4
6
|
|
5
7
|
module OJAD
|
6
8
|
class Verbs
|
@@ -10,7 +12,7 @@ module OJAD
|
|
10
12
|
|
11
13
|
def to_a
|
12
14
|
verbs.map do |verb_document|
|
13
|
-
|
15
|
+
Verb.new(verb_document)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
data/lib/ojad/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ojad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juanito Fatas
|
@@ -119,7 +119,7 @@ files:
|
|
119
119
|
- lib/ojad/client.rb
|
120
120
|
- lib/ojad/response.rb
|
121
121
|
- lib/ojad/result.rb
|
122
|
-
- lib/ojad/
|
122
|
+
- lib/ojad/verb.rb
|
123
123
|
- lib/ojad/verbs.rb
|
124
124
|
- lib/ojad/version.rb
|
125
125
|
- ojad.gemspec
|