ruby_journal 0.0.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.
- checksums.yaml +7 -0
- data/lib/ruby_journal.rb +56 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 71f2742044935faf886420c48817bb0582d0b211705fe3e05caa54fd68ab1348
|
4
|
+
data.tar.gz: e478f4c70669f84ae0ab84a9c23149a44207472e6083a3b0b9e797998c40275f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b22b8d11b269a00c376bf452ed2a8b9b08994e623197b8a466181b99a22d8f882e582911efc053989a969317bcdea3e8b9f616f683d991370e968e49d89bc77a
|
7
|
+
data.tar.gz: 365e4c9e7292a41c3a3b3e8d58e630ecc81a873c43b6090d9d695daf6a50bf4f489f2735057d782961dc5ed5c180666c91f83004e4c62f43b33f1bd54d943bb8
|
data/lib/ruby_journal.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
class RubyJournal
|
2
|
+
def initialize
|
3
|
+
@entries = []
|
4
|
+
end
|
5
|
+
|
6
|
+
def write_entry
|
7
|
+
puts "Write your diary entry (type exit to finish):"
|
8
|
+
entry = ""
|
9
|
+
|
10
|
+
loop do
|
11
|
+
line = gets.chomp
|
12
|
+
break if line.downcase == 'exit'
|
13
|
+
entry += line +'\n'
|
14
|
+
end
|
15
|
+
|
16
|
+
@entries << {timestamp: Time.now, content: entry.chomp}
|
17
|
+
puts "Entry saved successfully! \u{1F4D4}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def read_entries
|
21
|
+
if @entries.empty?
|
22
|
+
puts "Your diary is empty. \u{1F4D6}"
|
23
|
+
else
|
24
|
+
puts "Diary Entries:"
|
25
|
+
@entries.each_with_index do |entry, index|
|
26
|
+
puts "#{index + 1}. #{entry[:timestamp]}:\n#{entry[:content]}\n\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Main Program
|
33
|
+
diary = RubyJournal.new
|
34
|
+
|
35
|
+
loop do
|
36
|
+
puts "\nDiary App Menu:"
|
37
|
+
puts "1. #{'Write an entry'.encode('utf-8')}"
|
38
|
+
puts "2. #{'Read entries'.encode('utf-8')}"
|
39
|
+
puts "3. #{'Exit'.encode('utf-8')}"
|
40
|
+
print "Select an option (1-3): "
|
41
|
+
|
42
|
+
choice = gets.chomp.to_i
|
43
|
+
|
44
|
+
case choice
|
45
|
+
when 1
|
46
|
+
diary.write_entry
|
47
|
+
when 2
|
48
|
+
diary.read_entries
|
49
|
+
when 3
|
50
|
+
puts "Exiting Diary App. Goodbye! \u{1F44B}"
|
51
|
+
break
|
52
|
+
else
|
53
|
+
puts "Invalid choice. Please enter 1, 2, or 3."
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_journal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Priya Srivastava
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: RubyJournal gem offers a seamless and convenient way for developers to
|
14
|
+
maintain a CLI journal with the simplicity and power of Ruby
|
15
|
+
email:
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/ruby_journal.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
|
+
rubygems_version: 3.4.10
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: A ruby CLI journal with the simplicity and power of Ruby
|
43
|
+
test_files: []
|