Module: ThirdBase::DateCompatClassMethods

Included in:
Date
Defined in:
lib/third_base/make_compat.rb

Overview

ThirdBase’s top level Date compatibility class, striving to be as close as possible to the standard Date class’s API.

Instance Method Summary collapse

Instance Method Details

#_strptime(str, fmt = '%F') ⇒ Object

Parse the date using strptime with the given format.



266
267
268
# File 'lib/third_base/make_compat.rb', line 266

def _strptime(str, fmt='%F')
  strptime(str, fmt)
end

#civil(year = -4712,, mon = 1, day = 1, sg = nil) ⇒ Object

Creates a new Date with the given year, month, and day of month, ignores sg.



271
272
273
# File 'lib/third_base/make_compat.rb', line 271

def civil(year=-4712, mon=1, day=1, sg=nil)
  super(year, mon, day)
end

#commercial(cwyear = 1582, cweek = 41, cwday = 5, sg = nil) ⇒ Object

Creates a new Date with the given commercial week year, commercial week, and commercial week day, ignores sg.



276
277
278
# File 'lib/third_base/make_compat.rb', line 276

def commercial(cwyear=1582, cweek=41, cwday=5, sg=nil)
  super(cwyear, cweek, cwday)
end

#jd(j = 0, sg = nil) ⇒ Object

Creates a new Date with the given julian date, ignores sg.



281
282
283
# File 'lib/third_base/make_compat.rb', line 281

def jd(j=0, sg=nil)
  super(j)
end

#ordinal(year = -4712,, yday = 1, sg = nil) ⇒ Object

Creates a new Date with the given year and day of year, ignores sg.



286
287
288
# File 'lib/third_base/make_compat.rb', line 286

def ordinal(year=-4712, yday=1, sg=nil)
  super(year, yday)
end

#parse(str = "-4712-01-01", comp = false, sg = nil) ⇒ Object

Parse given string using ThirdBase::Date’s date parser, ignores comp and sg.



291
292
293
# File 'lib/third_base/make_compat.rb', line 291

def parse(str="-4712-01-01", comp=false, sg=nil)
  super(str)
end

#strptime(str = "-4712-01-01", fmt = '%F', sg = nil) ⇒ Object

Parse given string using given format, ignores sg.



296
297
298
# File 'lib/third_base/make_compat.rb', line 296

def strptime(str="-4712-01-01", fmt='%F', sg=nil)
  super(str, fmt)
end

#today(sg = nil) ⇒ Object

Creates a new Date with today’s date, ignores sg.



301
302
303
# File 'lib/third_base/make_compat.rb', line 301

def today(sg=nil)
  super()
end