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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09ef91de4f6a336da1d97c7cd411ef95ec9f8900'
4
- data.tar.gz: a897af8c6f9bbefde3d83237517fa203ae8cf731
3
+ metadata.gz: 5d6ac7c590b53089f7ba6282b76de69d3c7e715f
4
+ data.tar.gz: e9fa4818938fb4fa0852d39bb6570106484e8491
5
5
  SHA512:
6
- metadata.gz: 3682a34f8cbcd17b55b8ee1a9019706405a8831203b4053b121999efd3025188c31028348dd0196562c88b3d983d589e042f6a93a18133efb194651f15e7a4ab
7
- data.tar.gz: bd9a055a26efd2e1ebcb11b200d27dafbd8d9e51ca5acb9c7cc5959cd653314014dfa6584ac1d9d63ebab353936c8568cee9a30cb89df94ed9e361633b55ebce
6
+ metadata.gz: 639f8164a3eec1e39d4e944df0e2aef16ff1654ef208bd4570373a8c4247266b6b6e121112836a2878d72a62d3ab284c81d5993c2b7da691bda298a975623d4a
7
+ data.tar.gz: 9d3af3797e862948779a4f3bcd00d3133e3fe40ef814c04a2d2970606c8ecfc3ffe7c7c5694150aa79d15444b4899c45d779b09cded37e523c2f7c3687d833b3
data/.travis.yml CHANGED
@@ -5,5 +5,4 @@ install:
5
5
  - gem install bundler --pre
6
6
  - bundle install
7
7
  script:
8
- - rubocop
9
8
  - bundle exec rspec
data/lib/bibo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bibo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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: 2017-12-29 00:00:00.000000000 Z
12
+ date: 2018-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler