alba_habla 0.0.3 → 0.0.4
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/alba_habla.rb +1 -1
- data/lib/alba_habla/commands.rb +11 -2
- 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: 14cbe384a315e1c62b1948c0510df8106e53b9e4
|
4
|
+
data.tar.gz: f954b9fcc6691dee46f47511f1000eafd1f16f50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a9a12946ac72aebcaca0b4c9eb77b804970fcf5eb0c849427a547a59bbc717db15e40131178a508e66eb1de0d6b3a0665d9c222d1de5ef7c40148ed87509aed
|
7
|
+
data.tar.gz: bbc5294d5078ee2a3034cecafdc4fda7d48ea642a709a7049ca754b2207487052cc8e471af6ae5fba63025ecf26e49c09b1899fd6a4927194b99155df7acf3cc
|
data/lib/alba_habla.rb
CHANGED
data/lib/alba_habla/commands.rb
CHANGED
@@ -42,6 +42,8 @@ module AlbaHabla
|
|
42
42
|
`#{talk_command} "#{string}"`
|
43
43
|
end
|
44
44
|
|
45
|
+
# Convenience mapping of a few books.
|
46
|
+
# i.e. typing "read sam" is the same as "read green_eggs_and_ham.txt"
|
45
47
|
def books
|
46
48
|
{
|
47
49
|
'sam' => 'green_eggs_and_ham.txt',
|
@@ -52,6 +54,13 @@ module AlbaHabla
|
|
52
54
|
}
|
53
55
|
end
|
54
56
|
|
57
|
+
def book_file(book_name)
|
58
|
+
File.join(
|
59
|
+
@book_path,
|
60
|
+
books.key?(book_name) ? books[book_name] : book_name
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
55
64
|
def word_bag
|
56
65
|
@word_bag || begin
|
57
66
|
bag = []
|
@@ -65,8 +74,8 @@ module AlbaHabla
|
|
65
74
|
end
|
66
75
|
|
67
76
|
def read(book_name)
|
68
|
-
if
|
69
|
-
IO.foreach(
|
77
|
+
if File.exist?(book_file(book_name))
|
78
|
+
IO.foreach(book_file(book_name)) do |line|
|
70
79
|
puts line
|
71
80
|
talk line.delete('"')
|
72
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alba_habla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mertonium
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|