Advertisement
saasbook

date_calculator_5.rb

Jan 10th, 2012
1,980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.65 KB | None | 0 0
  1. # This class calculates the current year given an origin day
  2. # supplied by a clock chip.
  3. #
  4. # Author:: Armando Fox
  5. # Copyright:: Copyright(C) 2011 by Armando Fox
  6. # License::  Distributed under the BSD License
  7. #
  8. class DateCalculator
  9.   #
  10.   #  Create a new DateCalculator initialized to the origin year
  11.   # * +origin_year+ - days will be calculated from Jan. 1 of this year
  12.   #
  13.   def initialize(origin_year)
  14.     @origin_year = origin_year
  15.   end
  16.   #
  17.   # Returns current year, given days since origin year
  18.   # * +days_since_origin+ - number of days elapsed since Jan. 1 of origin year
  19.   #
  20.   def current_year_from_days(days_since_origin)
  21.     return @origin_year
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement