Class: Cliptic::Database::Stats

Inherits:
State
  • Object
show all
Defined in:
lib/cliptic/database.rb

Constant Summary

Constants included from Chars

Chars::Block, Chars::HL, Chars::LL, Chars::LS, Chars::LU, Chars::MS, Chars::Nums, Chars::RL, Chars::RS, Chars::RU, Chars::TD, Chars::TL, Chars::TR, Chars::TU, Chars::Tick, Chars::VL, Chars::XX

Instance Attribute Summary

Attributes inherited from State

#chars, #date, #done, #n_done, #n_tot, #reveals, #time

Attributes inherited from SQL

#db, #table

Instance Method Summary collapse

Methods inherited from State

#cols, #delete, #exists?, #save

Methods included from Chars

small_num

Methods inherited from SQL

#delete, #drop, #insert, #make_table, #select, #update

Constructor Details

#initialize(date: Date.today) ⇒ Stats

Returns a new instance of Stats.



165
166
167
# File 'lib/cliptic/database.rb', line 165

def initialize(date:Date.today)
  super(date:date)
end

Instance Method Details

#exist_strObject



171
172
173
174
175
176
177
# File 'lib/cliptic/database.rb', line 171

def exist_str
  <<~stats
    Time  #{VL} #{Time.abs(time).to_s}
    Clues #{VL} #{n_done}/#{n_tot}
    Done  #{VL} [#{done ? Tick : " "}]
  stats
end

#new_strObject



178
179
180
# File 'lib/cliptic/database.rb', line 178

def new_str
  "\n  Not attempted\n"
end

#stats_strObject



168
169
170
# File 'lib/cliptic/database.rb', line 168

def stats_str
  (exists? ? exist_str : new_str).split("\n")
end