lloydpick-toast 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.
Files changed (2) hide show
  1. data/lib/toast.rb +27 -0
  2. metadata +1 -1
data/lib/toast.rb CHANGED
@@ -179,6 +179,33 @@ module Toast
179
179
  end
180
180
  end
181
181
 
182
+ def self.check
183
+ db = SQLite3::Database.new("toast.db")
184
+
185
+ db.results_as_hash = true
186
+ puts "Listing Toasters in toast.db...\n"
187
+ puts "------------------------------------------------------------"
188
+ db.execute("select * from toasters group by complete") do |toaster|
189
+ puts "\tID:\t\t" + toaster["id"]
190
+ puts "\tFrequency:\t" + toaster["frequency"]
191
+ puts "\tLast check:\t" + toaster["last_check"]
192
+ puts "\tNext check:\t" + (Time.parse(toaster["last_check"]) + toaster["frequency"].to_i).to_s
193
+ puts "\tTime now:\t" + Time.now.to_s
194
+ puts "\tOverdue?\t" + if ((Time.parse(toaster["last_check"]) + toaster["frequency"].to_i) < Time.now) then "Yes" else "No" end
195
+ puts "\tComplete?\t" + if (toaster["complete"].to_i == 1) then "Yes" else "No" end
196
+ puts "\n\tConditions...\n"
197
+ toaster["conditions"].split(",").each do |pre_condition|
198
+ db.execute("select * from butters where id = #{pre_condition}") do |condition|
199
+ puts "\n\tID:\t\t" + condition["id"]
200
+ puts "\tName:\t\t" + condition["name"]
201
+ puts "\tFunction:\t" + condition["function"]
202
+ puts "\tOutcome:\t" + condition["outcome"]
203
+ end
204
+ end
205
+ puts "------------------------------------------------------------\n"
206
+ end
207
+ end
208
+
182
209
  end
183
210
 
184
211
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lloydpick-toast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lloyd Pick