Skip to content

Commit

Permalink
add passing in the current_sheet, in case anybody needs it
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderpantsGnome authored and samg committed Jan 28, 2014
1 parent a991a93 commit 37351e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/timetrap/auto_sheets/dotfiles.rb
@@ -1,6 +1,11 @@
module Timetrap
module AutoSheets
class Dotfiles
attr_accessor :current_sheet

def initialize(current_sheet)
self.current_sheet = current_sheet
end

def sheet
dotfile = File.join(Dir.pwd, '.timetrap-sheet')
Expand Down
11 changes: 7 additions & 4 deletions lib/timetrap/timer.rb
Expand Up @@ -62,12 +62,15 @@ def current_sheet= sheet
end

def current_sheet
return auto_sheet if auto_sheet

unless Meta.find(:key => 'current_sheet')
Meta.create(:key => 'current_sheet', :value => 'default')
end
Meta.find(:key => 'current_sheet').value

if the_auto_sheet = auto_sheet
the_auto_sheet
else
Meta.find(:key => 'current_sheet').value
end
end

def last_sheet
Expand Down Expand Up @@ -128,7 +131,7 @@ def start note, time = nil

def auto_sheet
if Timetrap::Config['auto_sheet']
load_auto_sheet(Config['auto_sheet']).new.sheet
load_auto_sheet(Config['auto_sheet']).new(Meta.find(:key => 'current_sheet').value).sheet
end
end
end
Expand Down

0 comments on commit 37351e5

Please sign in to comment.