Permalink
Browse files

Modified the year_range method using what Chris Doggett showed in his…

… example on my blog post.
  • Loading branch information...
1 parent 1349064 commit 179f64d9cbf3a4cd1dcd47db2549fb1f3266efd3 @robbyrussell committed Mar 25, 2008
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/year_after_year.rb
@@ -6,12 +6,8 @@ def current_year
Time.now.strftime('%Y')
end
- def year_range(start_year)
- if start_year.to_s == current_year
- current_year
- else
- start_year.to_s + '-' + current_year
- end
+ def year_range( start_year = Date.today().year )
+ [start_year, Date.today().year].sort.uniq.join('-')
end
end
end

0 comments on commit 179f64d

Please sign in to comment.