dephine 0.2.0 → 0.2.1
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.
- data/README.md +5 -0
- data/dephine.gemspec +1 -0
- data/lib/dephine.rb +3 -0
- data/lib/dephine/cli.rb +5 -14
- data/lib/dephine/dictionary.rb +2 -2
- data/lib/dephine/tui.rb +0 -3
- data/lib/dephine/version.rb +1 -1
- metadata +18 -2
data/README.md
CHANGED
@@ -22,6 +22,11 @@ Google dictionary in terminal
|
|
22
22
|
anything
|
23
23
|
|
24
24
|
pronoun /ˈenēˌTHiNG/
|
25
|
+
Used to refer to a thing, no matter what
|
26
|
+
- nobody was saying anything
|
27
|
+
- have you found anything?
|
28
|
+
- he inquired whether there was anything he could do
|
29
|
+
|
25
30
|
Used for emphasis
|
26
31
|
- I was ready for anything
|
27
32
|
|
data/dephine.gemspec
CHANGED
data/lib/dephine.rb
CHANGED
data/lib/dephine/cli.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
1
|
module Dephine
|
4
2
|
|
5
3
|
# Public: Make a simple Command Line Interface.
|
@@ -75,20 +73,13 @@ module Dephine
|
|
75
73
|
end
|
76
74
|
|
77
75
|
if word.pronunciations.length > 0
|
78
|
-
#
|
79
|
-
|
80
|
-
|
81
|
-
# download pronunciation mp3 and save to tempfile
|
82
|
-
File.open(file, "wb") do |saved_file|
|
83
|
-
open(word.pronunciations[0][:url], 'rb') do |read_file|
|
84
|
-
saved_file.write(read_file.read)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
file.close()
|
76
|
+
# download pronunciation audio file
|
77
|
+
open(word.pronunciations[0][:url])
|
78
|
+
pronunciation = OpenURI::Cache.send(:filename_from_url, word.pronunciations[0][:url])
|
88
79
|
|
89
|
-
# play
|
80
|
+
# play pronunciation
|
90
81
|
t.set_key 'p' do
|
91
|
-
play(
|
82
|
+
play(pronunciation)
|
92
83
|
end
|
93
84
|
end
|
94
85
|
|
data/lib/dephine/dictionary.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'open-uri'
|
1
|
+
require 'open-uri/cached'
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module Dephine
|
@@ -37,7 +37,7 @@ module Dephine
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# add meanings
|
40
|
-
primary['entries']
|
40
|
+
primary['entries'].each do |entry|
|
41
41
|
@meanings[-1][:meanings] << {
|
42
42
|
text: entry['terms'][0]['text'].gsub('x27', "'") \
|
43
43
|
.gsub(/x3.*?3e/, ''),
|
data/lib/dephine/tui.rb
CHANGED
data/lib/dephine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dephine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ncursesw
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.2.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: open-uri-cached
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
description:
|
31
47
|
email:
|
32
48
|
- contact@s1n4.com
|