class Thirsty::Today::Get

Public Instance Methods

call() click to toggle source
# File lib/thirsty/today/get.rb, line 8
def call
  return 0.0 unless file_exists?

  today
end

Private Instance Methods

file_exists?() click to toggle source
# File lib/thirsty/today/get.rb, line 20
def file_exists?
  File.exist?(file_path)
end
file_path() click to toggle source
# File lib/thirsty/today/get.rb, line 16
def file_path
  @file_path ||= File.expand_path("~/.thirsty/#{Date.today}.txt")
end
today() click to toggle source
# File lib/thirsty/today/get.rb, line 24
def today
  File.read(file_path).to_f
end