bibo 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/lib/bibo/version.rb +1 -1
- data/lib/bibo.rb +19 -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: 5d6ac7c590b53089f7ba6282b76de69d3c7e715f
|
4
|
+
data.tar.gz: e9fa4818938fb4fa0852d39bb6570106484e8491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 639f8164a3eec1e39d4e944df0e2aef16ff1654ef208bd4570373a8c4247266b6b6e121112836a2878d72a62d3ab284c81d5993c2b7da691bda298a975623d4a
|
7
|
+
data.tar.gz: 9d3af3797e862948779a4f3bcd00d3133e3fe40ef814c04a2d2970606c8ecfc3ffe7c7c5694150aa79d15444b4899c45d779b09cded37e523c2f7c3687d833b3
|
data/.travis.yml
CHANGED
data/lib/bibo/version.rb
CHANGED
data/lib/bibo.rb
CHANGED
@@ -1,7 +1,25 @@
|
|
1
1
|
require "bibo/version"
|
2
|
+
require "json"
|
2
3
|
|
3
4
|
module Bibo
|
4
5
|
class Bibo
|
5
|
-
|
6
|
+
attr_accessor :content
|
7
|
+
|
8
|
+
def initialize(src)
|
9
|
+
@content = ::JSON.parse(File.read(src))
|
10
|
+
end
|
11
|
+
|
12
|
+
def question(question)
|
13
|
+
filtered_question = question.downcase.strip.delete(" ")
|
14
|
+
find_anwser(filtered_question)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def find_anwser(key)
|
20
|
+
response = @content.fetch(key, "Nani?")
|
21
|
+
return response.sample if response.is_a?(Array)
|
22
|
+
response
|
23
|
+
end
|
6
24
|
end
|
7
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HuanNV
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|