Skip to content

Commit

Permalink
replace calendar method to faster version
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Apr 24, 2016
1 parent 9fb5804 commit 91d4150
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lib/tdiary/io/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,6 @@ def transaction( date )
end

def calendar
calendar = {}
Dir["#{@data_path}????"].sort.each do |dir|
next unless %r[/\d{4}$] =~ dir
Dir["#{dir.untaint}/??????.td2"].sort.each do |file|
year, month = file.scan( %r[/(\d{4})(\d\d)\.td2$] )[0]
next unless year
calendar[year] = [] unless calendar[year]
calendar[year] << month
end
end
calendar
end

def calendar2
calendar = {}
Dir["#{@data_path}????/??????.td2"].sort.each do |file|
if file =~ /(\d{4})(\d{2})\.td2$/
Expand Down

0 comments on commit 91d4150

Please sign in to comment.