Class: Date
- Inherits:
-
Object
- Object
- Date
- Defined in:
- lib/activefacts/api/date.rb
Overview
A Date can be constructed from any Date or DateTime subclass, or parsed from a String
Class Method Summary collapse
Class Method Details
.new_instance(constellation, *a, &b) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/activefacts/api/date.rb', line 14 def self.new_instance constellation, *a, &b if a[0].is_a?(String) d = parse(*a) elsif (a.size == 1) case a[0] when DateTime d = civil(a[0].year, a[0].month, a[0].day, a[0].start) when Date d = civil(a[0].year, a[0].month, a[0].day, a[0].start) when NilClass d = civil() else d = civil(*a, &b) end else d = civil(*a, &b) end d.send(:instance_variable_set, :@constellation, constellation) d end |