fun_facts 0.0.0
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 +7 -0
- data/lib/fun_facts.rb +31 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a734c78366cedc62dac6f83e1eed342f36498b01
|
|
4
|
+
data.tar.gz: cab6363e0b1e0e8b628f2ce36778af98f6ea4e7e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3a57bd70d65c8ba0505cb4bd96485d97c2a6039041aeaf0e0c440b81f687880dc7a02d6726e5eaf8bb279261e8a1713e85ca7ab8308656a1a9ca898d465827ef
|
|
7
|
+
data.tar.gz: fe1d1b1d611da46647e8cf37fd25323af3443295faf9f2bae92a3bf5bce267ecb10832f6f1b72069c184808cf40306dd9b65fdd9f2fe1b46d22b38637bbab3cd
|
data/lib/fun_facts.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Fun
|
|
2
|
+
class Facts
|
|
3
|
+
def self.funfacts?
|
|
4
|
+
db = SQLite3::Database.new("trivia_facts.db")
|
|
5
|
+
create_table_cmd = <<-SQL
|
|
6
|
+
CREATE TABLE IF NOT EXISTS trivia_facts(
|
|
7
|
+
id INTEGER PRIMARY KEY,
|
|
8
|
+
name VARCHAR(255),
|
|
9
|
+
fact VARCHAR(500)
|
|
10
|
+
)
|
|
11
|
+
SQL
|
|
12
|
+
db.execute(create_table_cmd)
|
|
13
|
+
|
|
14
|
+
puts "What's your name?"
|
|
15
|
+
@name = gets.chomp.downcase
|
|
16
|
+
puts "What interesting fact do you know?"
|
|
17
|
+
@fact = gets.chomp.downcase
|
|
18
|
+
|
|
19
|
+
db.execute("INSERT INTO trivia_facts (name, fact) VALUES (?, ?)", @name, @fact)
|
|
20
|
+
@random = db.execute("SELECT trivia_facts.fact FROM trivia_facts ORDER BY RANDOM() LIMIT 1")
|
|
21
|
+
|
|
22
|
+
puts "Do you wanna know what is quite funny? Answer yes or no"
|
|
23
|
+
answer = gets.chomp
|
|
24
|
+
if answer == "yes"
|
|
25
|
+
puts "You will never believe...Did you know that #{@random[0][0]}?"
|
|
26
|
+
else
|
|
27
|
+
puts "Oh, ok. NEVERMIND!"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fun_facts
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- yulkalongneck
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2011-09-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description:
|
|
14
|
+
email:
|
|
15
|
+
- juliadolgoszyja@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/fun_facts.rb
|
|
21
|
+
homepage:
|
|
22
|
+
licenses: []
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.2.2
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: Funny facts!
|
|
44
|
+
test_files: []
|